This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in giving onChange event in s:combobox

 
dhaval tamboli
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to give onChange event in combobox in strtuts2
Actually I want to make it like if user selects particular value from combobox then some fields will show up in same page. so, i am giving javascript code too, but still its not going.!

My Code is



and javascript is



But its not going in that function even the first line is also not printing.. i tried all onselect, onclick and onchange but none of them works. Let me know If i can do like this or not or if there is any other way to do it

Thanks
 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This particular event's proper functioning might depend on the
browser as well, have you tried the same with different browsers?
 
dhaval tamboli
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am making this application in eclipse and checking on that only but its not showing me up there
 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dhaval tamboli wrote:i am making this application in eclipse and checking on that only but its not showing me up there


Can you try different external browsers (e.g. Chrome, Firefox, IE) in Eclipse...and see the results...
 
dhaval tamboli
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried using both firefox and IE but its still same. I am not sure is this the only way to call javascript function? cause its not going in there!!
 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dhaval tamboli wrote:I tried using both firefox and IE but its still same. I am not sure is this the only way to call javascript function? cause its not going in there!!


Maybe this discussion might give you some clues?
 
dhaval tamboli
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI, I think my problem is total different.

I am posting whole jsp page as such it will extend once I can find combobox's selected value.

 
Richard Golebiowski
Ranch Hand
Posts: 213
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tested your code and it functions, but maybe not the way you think it should. If you view the generated HTML code, the onselect event is on the input box. If you select something from the select box and then select the text in the input box the event will fire.

Also, you should be calling alert in your function, not System.out.println.
 
dhaval tamboli
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I got your point but I dont know how to see generated html code and also I am confused regarding fetching combobox's value in javascript.

Thanks
 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dhaval tamboli wrote:I dont know how to see generated html code...


You can see generated html code by selecting the View Page Source option in your browser.
 
Richard Golebiowski
Ranch Hand
Posts: 213
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot get the selected value in the combo box, you will have to get the value from the text box. If you assign an id to your combo box, the id is assigned to the text box and you can get the value from the text box.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just out of curiosity, what do you believe this is going to do?!?!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic