Hi,
I tried to change the form action based on selection option and hoping that my javascript validation function working properly too... I found out one solution and hoping this javascript can do that kind of thing. I tried so many ways and I think there's something wrong with my function since my validation function not working and also the form action. I hope you guys can give some advise on my code. So here's my code for your references :
[JAVASCRIPT]
function validate(myForm)
{
with(myForm)
{
....................
};
return true;
};
function onSelectedOption(sel) {
if ((sel.selectedIndex) == 3) {
document.getElementById("myForm").action =
"a.php";
document.getElementById("myForm").submit();
}
else
{
document.getElementById("myForm").action =
"b.php";
document.getElementById("myForm").submit();
}
}
[HTML]
<form name="myForm" action="" method="POST">
<select name="selectA" id="selectA" onchange="onSelectedOption(this);">
<option value="0">- Choose ur selection -</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<input name="cmdSubmit" type="submit" value="Next" onClick="return validate(this)">
Really need your magic for my problem..