• Post Reply Bookmark Topic Watch Topic
  • New Topic

custom tag library

 
Avneet Singh
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guy's

I'm doing a bug fix on a custom tag library which basically makes a select statement and populates the options.It's doing that fine but it's suppose to invoke a javascript by onchnage event and has defined that function in the code. In the javascript to be called we need to send the value that is selected from that select combo on a webpage. the line in my jsp page is as follows -



I need to know wether 'this'(onchange="GenderPopulation(this)") being passed above to GenderPopulation function will pass the value selected from the combo box and also need to verify that hcp.prefix in the property field is the name attribute of html select tag.

Thanks to all in advance

[ January 25, 2007: Message edited by: Bear Bibeault ]

[BSouther: Added linebreaks to make the rest of the thread readable]
[ January 31, 2007: Message edited by: Ben Souther ]
 
Avneet Singh
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can any one provide me with some suggestions on this.
 
Stefan Evans
Bartender
Posts: 1822
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it a fix on the custom tag or the use of this custom tag? There is a subtle difference.


onchange="GenderPopulation(this)

In javascript, "this" refers to the object which is the target of the event.
In this case it is passing the select object itself to the javascript function GenderPopulation.
There are properties on the select object to determine its currently selected value.
 
Avneet Singh
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it's part of the custom tag 'GenderPopulation(this)'

all i want to know is that wether 'this' will send the selected value of the combo to the script.
 
Dhananjayan Karnam
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it's part of the custom tag 'GenderPopulation(this)'

So this will send the entire object if you want only value from the combo box try this.value
 
Dhananjayan Karnam
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it's part of the custom tag 'GenderPopulation(this)'

So this will send the entire object if you want only value from the combo box try 'GenderPopulation(this.value)
 
Avneet Singh
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks to all of you for helping me out
 
Quang Pham
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I would put a alert in the called function to see if the value is passed.<br>
<script language="JavaScript1.2" type="text/javascript">
function GenderPopulation(myOpt){
alert("selected option: " + myOpt.value);
}
</script>
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!