Hi all,
I am facing a strange problem.I have 2 submit button with onclick event.any one button will work at a single time.Each button is calling a separate function for validation.After the validation is done I want the form to be posted.I am using php as server side.
But after the validation part the form is not submitting.I am not getting the posted values.Here is the code:
[CODE]<script type=”text/javascript”>
function radio_button_checker()
{
var radio_choice = false;
for (counter = 0; counter < f.reply.length; counter++)
{
if (f.reply[counter].checked)
radio_choice = true;
}
if (!radio_choice)
{
alert(“Please select an option.”)
return (false);
}
return (true);
}
function val()
{
if(document.f.treply.value.length == “”)
{
alert(“Please input the answer.”);
return false;
}
}
</script>
[code=html]<form name=”f” method=”post” action=””>
<input type=’text’ name=’treply’ value=”>
<input type=’radio’ name=’reply’ value='<?=$polqr1[‘ans’];?>’>
<input name=”preo” type=”submit” value=”Submit” onclick=”radio_button_checker(f);return false;” />
<input name=”pret” type=”submit” value=”Submit” onclick=”val();return false;” />
</form>
So both of the submit button is calling separate function.Is it causing any problem in submitting the form values.
Please suggest me what should I do.
Thanks for your co-operation.
Regards,
Raj