Is it possible to put a few different form tags in a html page and the page still works properly? I wanted to create a page with a few input fields and a few submit buttons . Each different submit button clicked will pass different parameters to another page. Example there are name, age and gender fields with 3 submit buttons assigned to each of them. When i click submit button for name, only the parameter of name will be passed. Or are there a different way to accomplish this. Thanks.
Rollin, You can't use different form tags unless the form fields are distinct. You can have each button call a javascript function which sets a different form action and then submits the page:
Yeah you can have multiple form tags, they just can't be nested within each other. Also, only the fields defined within each form block will be submitted the "action" URL specified.
Thanks for the quick reply guys. Now I have a drop down box named groupings and I want this particular parameter value to be passed for whatever submit button clicked. Example I click the submit button for name and it also pass the groupings parameter. I click the age submit button and groupings parameter is passed and so on. Can I achieve this in html or do I have to put the drop down groupings box for each and every form tags in my html so that it got passed. If I do this I am afraid there is redundancy. Thanks
Dear Eric, May I know how to do your suggestion using javascript. I tried using jsp but it seems unable to pass value. I put this in other form tags <input name="groupselc" type="hidden" value=<%= nameg%>> with nameg being the name of the drop down box. I did not put the drop down box in form tag though. Do I need to put it in a form tag with another name. Thanks
No matter. Try again. Fail again. Fail better. This time, do it with this tiny ad: