tmurray22
asked on
Javascript change element to pick up request.form value
I have a form that was on one page and working fine. I split it up to two pages(for visual puposes)
but now my javascript doesnt work.
The codeline is now on form1
and this script is on form2
How do I change to reference the codeline value from form 2 ?
function checkValues(frm)
{
if ((frm.elements["codeline"] .options[f rm.element s["codelin e"].select edIndex].t ext=="5.0" )) frm.action="Testpost2.asp" ;
else frm.action="testpost.asp";
return true;
}
</script>
but now my javascript doesnt work.
The codeline is now on form1
and this script is on form2
How do I change to reference the codeline value from form 2 ?
function checkValues(frm)
{
if ((frm.elements["codeline"]
else frm.action="testpost.asp";
return true;
}
</script>
ASKER
yes. that works, but when I change the value like below it gives me the testpost2.asp everytime
<script>
function checkValues(frm){
if ((<% =Request.Form("cmpsub") %>=="dm3ssp")) frm.action="adfield.asp";
else frm.action="testpost.asp";
return true;
}
</script>
<script>
function checkValues(frm){
if ((<% =Request.Form("cmpsub") %>=="dm3ssp")) frm.action="adfield.asp";
else frm.action="testpost.asp";
return true;
}
</script>
Show both forms in HTML and ASP then I can analyze what you are doing.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That did it, Thanks
You are welcome
Then you can responde also the selected value into form2 page.
Like this:
function checkValues(frm){
if ((<% =Request.Form("codeline") %>=="5.0")) frm.action="Testpost2.asp"
else frm.action="testpost.asp";
return true;
}
</script>
But you should not do such simple scripts in JavaScript.
Better do it in ASP script and adapt the <form action= appropriate.