ajt2915
asked on
Multiple forms
I have two forms in one html and both needed to be posted to two different servlets.
<form name="mainFrm>
<form name="form1>
...onClick="sub(0)"
</form>
<form name="form2>
...onClick="sub(1)"
</form>
</form>
Following is the script I'm trying to execute from the onclick.
<Script language="javascript">
function sub(i){
document.mainFrm.method="p ost";
document.mainFrm.action=go (i);
document.mainFrm.submit();
}
function go(i){
var x,y;
if(i==0){x="abc"; y="/servlet1?id=" +x;}
if(i==1){x="123"; y="/servlet2?id=" +x;}
return y;
}
</script>
I'm having trouble posting the form.
<form name="mainFrm>
<form name="form1>
...onClick="sub(0)"
</form>
<form name="form2>
...onClick="sub(1)"
</form>
</form>
Following is the script I'm trying to execute from the onclick.
<Script language="javascript">
function sub(i){
document.mainFrm.method="p
document.mainFrm.action=go
document.mainFrm.submit();
}
function go(i){
var x,y;
if(i==0){x="abc"; y="/servlet1?id=" +x;}
if(i==1){x="123"; y="/servlet2?id=" +x;}
return y;
}
</script>
I'm having trouble posting the form.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I disagree with this one. Both solutions would work. Pts should goto objects.
CJ
CJ
I will leave a recommendation in the Cleanup topic area that this question is:
"Delete/No refunds."
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Kuldeepchaturvedi
EE Cleanup Volunteer