Here is my problem. After the user fills in the form objects, it is entered into the database via an AJAX event and not a form submission.
I simply pass the value of each form object by id to a page that inserts the data
Because I pass the values by getElementId I am having trouble with the radio buttons (who must have unique ID's). I am very new to AJAX and Javascript and need help figuring out a solution.
Here is my code.
HTML CODE
<td height='26' colspan='4'>Is the veteran deceased? Yes
<label>
<input type='radio' name='vet_deceased' id='vet_deceased1' value='1' />
No
<input type='radio' name='vet_deceased' id='vet_deceased2' value='2' />
</label></td>
AJAX CODE
if(document.getElementById('vet_deceased1').checked=true)
{
var vd = 1;
}
else if (document.getElementById 'vet_deceased2').checked=true)
{
var vd = 2;
}
(this is sent to a PHP page where vd is entered into the database)
Can someone help me figure out how to handle whether a radio button is checked or not and get the value of the checked radio button into a variable please.
I simply pass the value of each form object by id to a page that inserts the data
Because I pass the values by getElementId I am having trouble with the radio buttons (who must have unique ID's). I am very new to AJAX and Javascript and need help figuring out a solution.
Here is my code.
HTML CODE
<td height='26' colspan='4'>Is the veteran deceased? Yes
<label>
<input type='radio' name='vet_deceased' id='vet_deceased1' value='1' />
No
<input type='radio' name='vet_deceased' id='vet_deceased2' value='2' />
</label></td>
AJAX CODE
if(document.getElementById('vet_deceased1').checked=true)
{
var vd = 1;
}
else if (document.getElementById 'vet_deceased2').checked=true)
{
var vd = 2;
}
(this is sent to a PHP page where vd is entered into the database)
Can someone help me figure out how to handle whether a radio button is checked or not and get the value of the checked radio button into a variable please.