Here''s the code: <input type="HIDDEN" name="sig0" value="" id="sig0_hidden"> <input type="CHECKBOX" name="sig0" value="Monica Tetrault, LPC" class="radiocheck" id="sig0_checked"> <span style="">Monica Tetrault, LPC</span><br /> <input type="HIDDEN" name="sig1" value="" id="sig1_hidden"> <input type="CHECKBOX" name="sig1" value="Raphael Thigpen, Psy.D." class="radiocheck" id="sig1_checked"> <span style="">Raphael Thigpen, Psy.D.</span><br /> <span id="sig2_pre" style="display: none">Supervised by<br/></span> <input type="HIDDEN" name="sig2" value="" id="sig2_hidden"> <input type="CHECKBOX" name="sig2" value="Jeff Dersh, Ph.D. - Licensed Psychologist" class="radiocheck" id="sig2_checked"> <span style="">Jeff Dersh, Ph.D. - Licensed Psychologist</span> </div> <script language="javascript" type="text/javascript"> Event.observe("sig1_checked", "click", function(){ chkShowItem("sig1_checked", "sig2_pre"); }) </script> And the code for chkShowItem: function chkShowItem($sChk, $sID){ if($sChk== true) $($sID).style.display = ''inline''; else $($sID).style.display = ''none''; } The event is observed, but the $sChk.anyproperty returns undefined. How can it see the checkbox to detect the click, but not see any of it''s properties. I''m sure I''m just missing something simple, but I''ve spent an hour and I use this procedure a bunch in my code, and it works fine everywhere else. _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services www.pridedallas.com Work (214) 351-6600 ext. 119 Mobile (214) 906-5183 _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
You are passing in a string value as the 1st parameter, and then trying to compare it to the bool value true. If you are checking for the existance of the element, either pass in the actual element reference (not the string of the id), or try to get the element reference in the function before or within the if()... *function* chkShowItem($sChk, $sID){ * if*($($sChk)) $($sID).style.display = ''inline''; * else* $($sID).style.display = ''none''; } On 7/19/06, Keith Davis <keithdavis-mQJYS7++JhLwMB+CN6uaIQ@public.gmane.org> wrote:> > Here''s the code: > > <input type="HIDDEN" name="sig0" value="" id="sig0_hidden"> > <input type="CHECKBOX" name="sig0" value="Monica Tetrault, LPC" > class="radiocheck" id="sig0_checked"> > <span style="">Monica Tetrault, LPC</span><br /> > <input type="HIDDEN" name="sig1" value="" id="sig1_hidden"> > > <input type="CHECKBOX" name="sig1" value="Raphael Thigpen, Psy.D." > class="radiocheck" id="sig1_checked"> > > <span style="">Raphael Thigpen, Psy.D.</span><br /> > > <span id="sig2_pre" style="display: none">Supervised > by<br/></span> > > <input type="HIDDEN" name="sig2" value="" id="sig2_hidden"> > <input type="CHECKBOX" name="sig2" value="Jeff Dersh, Ph.D. - > Licensed Psychologist" class="radiocheck" id="sig2_checked"> > > <span style="">Jeff Dersh, Ph.D. - Licensed Psychologist</span> > </div> > > <script language="javascript" type="text/javascript"> > Event.observe("sig1_checked", "click", function(){ > chkShowItem("sig1_checked", "sig2_pre"); }) > </script> > > And the code for chkShowItem: > > *function* chkShowItem($sChk, $sID){ > > * if*($sChk==* true*) $($sID).style.display = ''inline''; > * else* $($sID).style.display = ''none''; > > } > > The event is observed, but the $sChk.anyproperty returns undefined. How > can it see the checkbox to detect the click, but not see any of it''s > properties. I''m sure I''m just missing something simple, but I''ve spent an > hour and I use this procedure a bunch in my code, and it works fine > everywhere else. > > > *_____________________* > *Thanks, * > > *Keith Davis - MCSA, A+, N+* > *P.R.I.D.E. - Director of Computer Services* > ***www.pridedallas.com*** > *Work (214) 351-6600 ext. 119* > *Mobile (214) 906-5183* > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Never mind. I''m checking to see if the CHECKBOX is true. Sometimes my brain gets stuck on one aspect of a problem and can''t see that''s something else. It''s suppose to be $($sChk).checked. Keith Davis (214) 906-5183 ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Ryan Gahl Sent: Wednesday, July 19, 2006 11:53 AM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails-spinoffs] Simple Problem, but I can''t find it You are passing in a string value as the 1st parameter, and then trying to compare it to the bool value true. If you are checking for the existance of the element, either pass in the actual element reference (not the string of the id), or try to get the element reference in the function before or within the if()... function chkShowItem($sChk, $sID){ if($($sChk)) $($sID).style.display = ''inline''; else $($sID).style.display = ''none'' ; } On 7/19/06, Keith Davis <keithdavis-mQJYS7++JhLwMB+CN6uaIQ@public.gmane.org> wrote: Here''s the code: <input type="HIDDEN" name="sig0" value="" id="sig0_hidden"> <input type="CHECKBOX" name="sig0" value="Monica Tetrault, LPC" class="radiocheck" id="sig0_checked"> <span style="">Monica Tetrault, LPC</span><br /> <input type="HIDDEN" name="sig1" value="" id="sig1_hidden"> <input type="CHECKBOX" name="sig1" value="Raphael Thigpen, Psy.D." class="radiocheck" id="sig1_checked"> <span style="">Raphael Thigpen, Psy.D.</span><br /> <span id="sig2_pre" style="display: none">Supervised by<br/></span> <input type="HIDDEN" name="sig2" value="" id="sig2_hidden"> <input type="CHECKBOX" name="sig2" value="Jeff Dersh, Ph.D. - Licensed Psychologist" class="radiocheck" id="sig2_checked"> <span style="">Jeff Dersh, Ph.D. - Licensed Psychologist</span> </div> <script language="javascript" type="text/javascript"> Event.observe("sig1_checked", "click", function(){ chkShowItem("sig1_checked", "sig2_pre"); }) </script> And the code for chkShowItem: function chkShowItem($sChk, $sID){ if($sChk== true ) $($sID).style.display = ''inline''; else $($sID).style.display = ''none'' ; } The event is observed, but the $sChk.anyproperty returns undefined. How can it see the checkbox to detect the click, but not see any of it''s properties. I''m sure I''m just missing something simple, but I''ve spent an hour and I use this procedure a bunch in my code, and it works fine everywhere else. _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services www.pridedallas.com Work (214) 351-6600 ext. 119 Mobile (214) 906-5183 _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs