Submitting form in post method.

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
GK
Beginner
Beginner
Posts: 7
Joined: Tue Apr 10, 2007 12:18 pm

Submitting form in post method.

Post by GK »

Onclicking menu item I would like to pass the method type as "post/get".
Is it is possible?

If it is possible please, let me know the solution.

{In 'menu-data.js' file with in the "aI()" there is an attribute URL, like this there is any attribute with name "method" for the solution of my query?}


Thanks
Ganga Krishna.
Last edited by GK on Tue Apr 17, 2007 6:14 am, edited 1 time in total.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

No, as far as I know there's no attribute to set post/get. But, you can do forms in the aI where you can set it. Try a search using the term forms set for this forum. There are a bunch of results, though I don't know what you might need, since you didn't specify any particular thing.

Ruth
GK
Beginner
Beginner
Posts: 7
Joined: Tue Apr 10, 2007 12:18 pm

Post by GK »

Hi Ruth,

Thanks for reply.

I searched as you mentioned, but unable to find the solution to my problem.

As you mentioned you are not clear about my problem, here I am mentioning my problem clearly.

"When we click on the menu option, request will go with 'get method' type and will show the screen. But I want the request to be go in 'post method' type and show the screen."


Thanks
Ganga Krishna.
GK
Beginner
Beginner
Posts: 7
Joined: Tue Apr 10, 2007 12:18 pm

Submitting form in post method.

Post by GK »

Hi,

For form submission by post method I followed like this. Is this is the correct or any other solution exist?

Actual code is like this.
In "mmenudom.js" in the function 'o$()' at 'onclick' event '$K()' function is called and in this function submitting the form, but it is in the get method.

What I followed:
In "mmenudom.js" in the function 'o$()' at 'onclick' event I replaced calling of '$K()' with my own function calling.
My function code is,

Code: Select all

function callmemenu(url)
    {
          document.<formname>.action=url;
          document.<formname>.submit();  
    }
The above function is written in the jsp where I used my menu.
By this way I am able to submit the form in 'post' method.

Thanks
Ganga Krishna.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

I found you an example of a form in the menu using the method=post
as far as I know you can just put in whatever method it is you need/use. The aI string would be set as type=form; You'll see it in this post and the response to it.

viewtopic. ... 0998#30998

Ruth
GK
Beginner
Beginner
Posts: 7
Joined: Tue Apr 10, 2007 12:18 pm

Post by GK »

Hi Ruth,

In the link you have provided they used like this to submit form in post method.

Code: Select all

aI("text=<form method=post action=http://www.laurentian.ca/cgi-bin/htsearch_e.cgi><input type=text name=words size=15><input type=submit value=go></form>;type=form;");
In my menu for one of the option I used previously like this:

Code: Select all

aI("text=Procesar Datos TVR;url=/Cavali/TVRMainAction.do;itemwidth=150;"); 
Now I replaced this with,

Code: Select all

aI("text=<form method=post action=/Cavali/TVRMainAction.do></form>;type=form;");
this leads to script error and menu options list is disappeared.

And also I placed the same code as in link page

Code: Select all

aI("text=<form method=post action=http://www.laurentian.ca/cgi-bin/htsearch_e.cgi><input type=text name=words size=15><input type=submit value=go></form>;type=form;");
as one of the menu option. It also leads to same error.

Thanks
Ganga Krishna.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

Well, the error I'm getting when you use the one I posted as a link is that the file is not found, that the page doesn't exist, which of course you'd not get anything if the page isn't available anymore.


As to the one you have, how exactly is it supposed to work? You can't even see it in the menu, there's nothing there to 'click' or whatever you want done. That would be like putting this on the page

Code: Select all

<form method=post action=/Cavali/TVRMainAction.do></form>
If you post that on the html page and then view the page you don't see it, because all it has is the form with no button to submit, or options to pick, no link to click, there's nothing between the opening form and the closing form tag.

You keep saying you want method=post and as I showed you can put that in the form, but you have to have some way to get the form to work.

Ruth
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

GK wrote:And also I placed the same code as in link page

Code: Select all

aI("text=<form method=post action=http://www.laurentian.ca/cgi-bin/htsearch_e.cgi><input type=text name=words size=15><input type=submit value=go></form>;type=form;");
as one of the menu option. It also leads to same error.
It looks to me like this code should work.

Please post a URL so we can get a better look.
John
Post Reply