Welcome to WebmasterWorld Guest from 54.226.130.194

Forum Moderators: incrediBILL

Message Too Old, No Replies

form within another form

how do i do it?

     

jigga

8:48 pm on Aug 20, 2001 (gmt 0)

10+ Year Member



is it possible to have a form within another form?
ie:
<Form ACTION="process.cfm" METHOD="post">
<Form ACTION="frm" METHOD="">
</form>
</form>

i can't seem to be able to make it work.
what i need it for is that i have a form, for people to fill out their address, and then the smaller form inside is just for the country and states/provinces. if the person selects USA as the country, then it lists the states in the next drop down. if they select canada, it lists the provinces in that drop down. i couldnt get it to work by placing the code in the inner form into the outer form, and i want it all submitted together.. so what can i do ? any help? thanks!!!

Brett_Tabke

8:57 pm on Aug 20, 2001 (gmt 0)

WebmasterWorld Administrator brett_tabke is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



By nature the two forms can't live within each other. The problem is the submit doesn't know which form you are submitting. There are ways with certain browsers that you can do two forms, but it is not universal enough to work for everyone.

There are other ways you can do it. One way that I use, is to use two submit buttons.

<form>
Foo: <select name="bar"><options...>various options</select>
<input type=submit name="bar" value="bar">

Bar:
<select name="foo"><options...>various options</select>
<input type=submit name="foo" value="foo">

</form>

If the user wants to do "foo", then the submit button value "foo" is transmited with the form, but not the "bar" value and vice versa.

Then your program that receives the values checks to see which submit button the user pressed and only uses the associate form values for that option.

jatar_k

9:05 pm on Aug 20, 2001 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



you can make the drop down reload the same page and pass the information to itself so that it reloads with the proper country info.

this is even easier if you use php or an equivalent language but you can do it with html and javascript.

jigga

9:32 pm on Aug 20, 2001 (gmt 0)

10+ Year Member



jatar k

how might i be able to do this? can u elaborate???

jigga

9:45 pm on Aug 20, 2001 (gmt 0)

10+ Year Member



for example, if you look at www.hotmail.com
and you go to SIGN UP for a free email account...
link: [lc3.law13.hotmail.passport.com...]

if you change the country to Canada, it will reload and list you the canadian provinces. how do they do that?

jatar_k

1:13 am on Aug 21, 2001 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



it looks like the hotmail one submits a "change" variable with the onChange event of the drop down box.

You output a variable to each input value attribute. When the form loads initially there are no values so they deafault to whatever you have set up, or just come up blank. If you send values to itself it will load them into the appropriate boxes or make the changes to the select box.

I would use a switch case to handle all of the different possibilities for your select box.