[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Select OnChange does not work or fire.

Posted on 2005-04-25
6
Medium Priority
?
526 Views
Last Modified: 2008-03-10
I'm now bald, thank you very much!

Why does this work:
                  "<SELECT size=1 name=\"Item_1_Size\" onChange=\"This.Form.Submit()\">
         <OPTION value=14x22 selected>14\" x 22\"</OPTION>
         <OPTION value=11x28>11\" x 28\"</OPTION>
         <OPTION value=22x28>22\" x 28\"</OPTION>
         <OPTION value=0 >Item Size</OPTION></SELECT>";

But not this:

<SCRIPT TYPE=\"text/javascript\">
<!--
function Update()
{
      alert(\"no fewer than 50!\")
      document.Form1.action = \"/cgi-bin/order.cgi\";           // Does not fire even with this line remarked out
      document.Form1.submit();                  // Does not fire even with this line remarked out
      return true;
}
// -->
</SCRIPT>



                  "<SELECT size=1 name=\"Item_1_Size\" onChange=\"Update()\">
         <OPTION value=14x22 selected>14\" x 22\"</OPTION>
         <OPTION value=11x28>11\" x 28\"</OPTION>
         <OPTION value=22x28>22\" x 28\"</OPTION>
         <OPTION value=0 >Item Size</OPTION></SELECT>";


I need to submit this back to the orgination cgi for error checking and price calculations.

0
Comment
Question by:jasgot
5 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 1000 total points
ID: 13861991
Change the select tag to this:

 "<SELECT size=1 name='Item_1_Size' onChange='Update(this)'>

And the function change to this:

<SCRIPT TYPE='text/javascript'>
<!--
function Update(theSel){
     alert('no fewer than 50!')
     theSel.form.action = '/cgi-bin/order.cgi';  
     theSel.form.submit();  
     return true;
}
// -->
</SCRIPT>

0
 
LVL 63

Expert Comment

by:Zvonko
ID: 13862008
Oh, and this surely does not work:
  "<SELECT size=1 name=\"Item_1_Size\" onChange=\"This.Form.Submit()\">

Perhaps this is what you wanted to post:
  "<SELECT size=1 name=\"Item_1_Size\" onChange=\"this.form.submit()\">

0
 
LVL 5

Expert Comment

by:prsupriya
ID: 13862499
Hello...

The function you are saying doesn't work functions fine in IE and firefox. Make sure that you have <SELECT is in the form named "Form1".

S:

0
 
LVL 12

Expert Comment

by:str_kani
ID: 13866437
the function update returns true after submitting !

but the calling statement doen't have any return
like return update();
?
0
 
LVL 10

Expert Comment

by:Andrew Beers
ID: 14592815
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:

http:Q_21401851.html --> Accept Zvonko
Any objections should be posted here in the next 4 days. After that time, the question will be closed.

~Aqua
EE Cleanup Volunteer
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
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

872 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