homepage Welcome to WebmasterWorld Guest from 54.227.40.166
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
form within another form
how do i do it?
jigga




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

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




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

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




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

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




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

jatar k

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

jigga




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

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




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved