This discussion is archived
4 Replies Latest reply: Feb 8, 2013 7:23 PM by John K. RSS

Javascript function needs to fire based on value set by a checkbox

John K. Newbie
Currently Being Moderated
Hi All, I am doing my best to learn javascript on and was hoping to not have to ask these types of questions but until I get fully educated I'm a bit stuck.

I am running a function on an apex page that checks the value in a tabular form LOV column and then does some stuff. This code works fine assuming that the column that I am evaluating is displayed as a 'Select List - Static LOV'. If I change the column to display as a checkbox, then this code no longer works. How should I change this to be able to read the value when set by a checkbox instead of an LOV?
var currIndex = $('select[name="''"]').index(pThis);
 // check current items value (return value of lov)
 if (pThis.value=='Y') 
Also, my function works when a user sets the value after the page is displayed but I also need it to do this same stuff on page load. Can I just copy the function into the html page body? Maybe if someone can just point me in the right direction I can continue to research. I know there have been threads on this but I'm still not fully clear on how I accomplish this.

Thanks in advance everyone for continuing to teach me apex.



  • Correct Answers - 10 points
  • Helpful Answers - 5 points