?
Solved

Javascript change element to pick up request.form value

Posted on 2006-04-26
6
Medium Priority
?
207 Views
Last Modified: 2008-02-26
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>

0
Comment
Question by:tmurray22
  • 4
  • 2
6 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 16545729
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
 

Author Comment

by:tmurray22
ID: 16547860
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
 
LVL 63

Expert Comment

by:Zvonko
ID: 16548449
Show both forms in HTML and ASP then I can analyze what you are doing.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 63

Accepted Solution

by:
Zvonko earned 2000 total points
ID: 16548459
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
 

Author Comment

by:tmurray22
ID: 16554714
That did it, Thanks
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 16554900
You are welcome
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question