Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting dynamic actions for a selection list?

 
Pat Peg
Ranch Hand
Posts: 195
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a page that contains multiple input fields of different types all contained in one form. I determine what action to take based on the following JS function

Inside the form/page I do


This is all working well for a submit button but now I need to do it for a drop down list as well in the same page. Has anyone done this and can you give me an example of how to expand what I am currently doing to include selection list?

Thanks
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use onchange or onblur in a selection list.

Eric
 
Pat Peg
Ranch Hand
Posts: 195
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying something like that. This is what I have added...



So this is what I think it should be doing. An item is selected from the drop down list and nav() is called.
I set a parameter, "OptionOne" to be the value of what ever was selected in the pull down.
I then forward to the same page I am on but now I can use the selected parameter. How far off am I?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why are you setting parameters? When you submit a form the values are passed to the next page. Am I missing something?

Eric
 
Pat Peg
Ranch Hand
Posts: 195
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More then likely I am missing something. The reason I am setting parameters is because I am trying to accomplish the following:
Item selected from list 'A', page reloads and that item 'A' will effect the values that are displayed in List 'B'. List 'B' is selected and that value will effect the items displayed in List 'C', etc. I am trying for a cascading effect of options provided based on the previous data selected.

In the above example, "OptionOne is a parameter not previously declared and will be a filter for another selection list on the page. Am I taking the long road to get across the street here?
 
Pat Peg
Ranch Hand
Posts: 195
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another odd thing is that when the page first loads it executes a java print statement that I put in the javascript function to trace the action. It will not execute again if I do select something from the menu.
 
Kyle Smith
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So no answer as to why OnChange fails to work?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic