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[frm.elements["codeline"].selectedIndex].text=="5.0")) frm.action="Testpost2.asp";
else frm.action="testpost.asp";
return true;
}
</script>

tmurray22Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZvonkoSystems architectCommented:
When form1 is submitted to server then you responde with the form2 page, right?
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.

0
tmurray22Author Commented:
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>
0
ZvonkoSystems architectCommented:
Show both forms in HTML and ASP then I can analyze what you are doing.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

ZvonkoSystems architectCommented:
And sorry, String compares has to be like this:

<script>
function checkValues(frm){
if (("<% =Request.Form("cmpsub") %>"=="dm3ssp")) frm.action="adfield.asp";
else frm.action="testpost.asp";
return true;
}
</script>

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tmurray22Author Commented:
That did it, Thanks
0
ZvonkoSystems architectCommented:
You are welcome
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.