SA SA wrote:
> After taking this a part, it turns out the problem is with two check
> boxes with same name. is there any way to get around this problem?
Yes, but you have many more problems than just that.
Try this, which includes several fixes [untested]:
<form id="login" name="login" method="post"
action="https://Check.gateway.com/Gateway.aspx"
onsubmit="return checkform(this)">
<input type="hidden" value="Account Balance" name="PMT_TYPE_DESC">
<input type="radio" value="" name="PMT_INDICATOR"> Check (Checking/Saving
Account)
<input type="radio" checked value="C" name="PMT_INDICATOR"> Credit Cards
<input type="submit" onclick="SubmitForm(this.form,
login.PMT_INDICATOR.value);" type="button" value="Login" name="submit1">
</form>
<script type="text/javascript">
function checkform(f) {
if (f.PMT_INDICATOR[0].checked) {
f.action = "https://creditcard.gateway.com/Gateway.aspx";
}
return true;
}
</script>
But, as a general rule, changing the action attribute of a form points to
bad design. If script is disabled, for example, your form breaks. Business
logic should be done on the server side.
As a final suggestion, see
http://www.javascripttoolbox.com/bestpractices/#forms
--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com