PDA

View Full Version : form help


Bluemonkey
03-27-2003, 03:10 PM
dont know if this is really asp more just forms, can i have more then one form on a page or form in side each other.

<form name=""addname"" id=""addname"" method=""post"" action=""Step_03.asp"">

</form>


<a href=""javascript:document.addname.submit();"">Add to address book</a>

<form name="form1" method="post" action="Step_03.asp">

</form>

<input type="submit" name="Submit" value="Submit">

and the button submits the main form

sorry if this is confusing

thanks for the help

raf
03-27-2003, 03:38 PM
multiple forms on one page is no problem.

nested forms : not possible (says the link)
http://redir.directhit.com/fcgi-bin/redirurl.fcg?url=http://info.netmar.com/creating/forms.html&qry=nested%20forms&rnk=1&cz=dcc79609ede2ccc7&src=DH_megadirectory_SRCH&u=0078833471

Maybe it is possible, but i never used/needed it.


You can have multiple forms on one page, that all submit to the same (asp-)page, or that submit to different pages. Or you can have forms in different html-pages that all submit to the same asp-page etc etc.

But i don't think this is gonna work

your code:
<form name="form1" method="post" action="Step_03.asp">

</form>

<input type="submit" name="Submit" value="Submit">



the submit need to be part of the form, so i should come before the form endtag (</form>

Bluemonkey
03-27-2003, 03:58 PM
ok thanks for the help

raf
03-27-2003, 04:08 PM
your welcome.

dominicall
03-27-2003, 05:50 PM
Another option is to have one form in the page with multiple submit buttons - and then have separate scripts in a single action page....

Just a thought...

dominicall

whammy
03-28-2003, 12:29 AM
Generally it's a good idea to stick with one form at a time. I've used multiple forms on a page that have different actions, with no problem - but you should not ever "nest" a form within another.

As raf's link points out:


Inside a FORM you can have anything except another FORM. Specifically, INPUT, SELECT, and TEXTAREA tags are used to specify interface elements within the form.


It's incorrect, besides there should never be a need for it. You can define different actions for forms, or change the action of a single form client-side using a javascript function onsubmit(), if it's totally necessary (although I can't think of a reason why offhand).

Also dominicall's suggestion requires some thought - you can name your submit buttons and retrieve the name of the submit button and then do your processing according to that, as well.