Click to See Complete Forum and Search --> : radio button sets more than one form elements


saintgregor
11-19-2003, 06:53 AM
hey!

i've got the following problem:
visitors have to choose one of 21 countries - listed with radiobuttons. The form sends everything to a database application. By checking the radio box I need to set 2 form elements - one for the database identification and one for the country in the address field. I guess the second variable will then be sent of as "hidden".
I think this is kinda simple, but not for a newbie...

thanks!
saint

rlmjinx
11-19-2003, 10:08 AM
One way to do this is to make an array when you retrieve the value.

Set the radiobuttons value to "countrytextthing,databaserequiredcodething", just two variables, separated by a comma, within one set of quotation-marks, no space.

Then when you retrieve the value, temporarily assign it to an array (edit bold text to fit your script):
YourArrayName = FormValue.split(',');

Now you can call the two variables with YourArrayName[0] and YourArrayName[1]...

saintgregor
11-19-2003, 12:44 PM
sorry, but that was a bit too tough for me.

i tried this:

<INPUT align="left" name="gb_country" type="radio" id="gb_country"
value="Belgium - french" onClick="document.gb_form.gb_databaseid.value=5426">

this makes the form store the data in the right database (gb_databaseid) but for some reason it does not store "Belgium - french" in the database. if i leave out the onclick it stores gb_country correct.

any idea?

thx.saint

saintgregor
11-19-2003, 01:03 PM
sorry for wasting your time folks.

it's working now - the page had a really stupid html error.

thx.anyway.saint