I''m not sure if I''m understanding this correctly. <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''mes_appearance_s0'', ''onchange'', function(e){ alert(''changed me!'') }); Event.observe(''headinjury'', ''click'', function(e){ alert(''clicked me!'') }); </SCRIPT> Neither of these produce any errors, nor do they work. _____________________ 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
Should be ''change'', not ''onchange''. Also, are you doing that after the elements in question have been added to the DOM (as in, farther down the page or in an onload event or something)? Greg ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Keith Davis Sent: Tuesday, June 27, 2006 1:08 PM To: Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Event.observe I''m not sure if I''m understanding this correctly. <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''mes_appearance_s0'', ''onchange'', function(e){ alert(''changed me!'') }); Event.observe(''headinjury'', ''click'', function(e){ alert(''clicked me!'') }); </SCRIPT> Neither of these produce any errors, nor do they work. _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services www.pridedallas.com <file:///\\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
After the elements have been added (the script is added dynamically in PHP.) Where is a list of the events and why don''t they match up with the actual event name? Anyway, the click doesn''t work either. 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 Gregory Hill Sent: Tuesday, June 27, 2006 2:12 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe Should be ''change'', not ''onchange''. Also, are you doing that after the elements in question have been added to the DOM (as in, farther down the page or in an onload event or something)? Greg ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Keith Davis Sent: Tuesday, June 27, 2006 1:08 PM To: Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Event.observe I''m not sure if I''m understanding this correctly. <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''mes_appearance_s0'', ''onchange'', function(e){ alert(''changed me!'') }); Event.observe(''headinjury'', ''click'', function(e){ alert(''clicked me!'') }); </SCRIPT> Neither of these produce any errors, nor do they work. _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services www.pridedallas.com <file:///\\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
Ok. Now the event is working, but here''s my real problem. Here''s the observe script: Event.observe(''mes_appearance_s0'', ''change'', ShowItem($F(''mes_appearance_s0''), ''other'', ''mes_appearance_s1'')); and the code for ShowItem: function ShowItem($value, $match, $item){ if($value == $match) $($item).style.display = "inline"; else $($item).style.display = "none"; } This results in a Type Mismatch error. 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 Gregory Hill Sent: Tuesday, June 27, 2006 2:12 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe Should be ''change'', not ''onchange''. Also, are you doing that after the elements in question have been added to the DOM (as in, farther down the page or in an onload event or something)? Greg ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Keith Davis Sent: Tuesday, June 27, 2006 1:08 PM To: Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Event.observe I''m not sure if I''m understanding this correctly. <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''mes_appearance_s0'', ''onchange'', function(e){ alert(''changed me!'') }); Event.observe(''headinjury'', ''click'', function(e){ alert(''clicked me!'') }); </SCRIPT> Neither of these produce any errors, nor do they work. _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services www.pridedallas.com <file:///\\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
That calls your function at the time you attach the event, returns the result from the function (null in this case) into the Event.observe function, which is expecting a function reference. So, it blows up. You want something more like: Event.observe(''mes_appearance_s0'', ''change'', function () { ShowItem($F(''mes_appearance_s0''), ''other'', ''mes_appearance_s1''); }); Greg ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Keith Davis Sent: Tuesday, June 27, 2006 3:22 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe Ok. Now the event is working, but here''s my real problem. Here''s the observe script: Event.observe(''mes_appearance_s0'', ''change'', ShowItem($F(''mes_appearance_s0''), ''other'', ''mes_appearance_s1'')); and the code for ShowItem: function ShowItem($value, $match, $item){ if($value == $match) $($item).style.display = "inline"; else $($item).style.display = "none"; } This results in a Type Mismatch error. 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 Gregory Hill Sent: Tuesday, June 27, 2006 2:12 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe Should be ''change'', not ''onchange''. Also, are you doing that after the elements in question have been added to the DOM (as in, farther down the page or in an onload event or something)? Greg ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Keith Davis Sent: Tuesday, June 27, 2006 1:08 PM To: Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Event.observe I''m not sure if I''m understanding this correctly. <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''mes_appearance_s0'', ''onchange'', function(e){ alert(''changed me!'') }); Event.observe(''headinjury'', ''click'', function(e){ alert(''clicked me!'') }); </SCRIPT> Neither of these produce any errors, nor do they work. _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services www.pridedallas.com <file:///\\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
Ah, that worked. Awesome. Thanks. 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 Keith Davis Sent: Tuesday, June 27, 2006 4:22 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe Ok. Now the event is working, but here''s my real problem. Here''s the observe script: Event.observe(''mes_appearance_s0'', ''change'', ShowItem($F(''mes_appearance_s0''), ''other'', ''mes_appearance_s1'')); and the code for ShowItem: function ShowItem($value, $match, $item){ if($value == $match) $($item).style.display = "inline"; else $($item).style.display = "none"; } This results in a Type Mismatch error. 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 Gregory Hill Sent: Tuesday, June 27, 2006 2:12 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe Should be ''change'', not ''onchange''. Also, are you doing that after the elements in question have been added to the DOM (as in, farther down the page or in an onload event or something)? Greg ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Keith Davis Sent: Tuesday, June 27, 2006 1:08 PM To: Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Event.observe I''m not sure if I''m understanding this correctly. <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''mes_appearance_s0'', ''onchange'', function(e){ alert(''changed me!'') }); Event.observe(''headinjury'', ''click'', function(e){ alert(''clicked me!'') }); </SCRIPT> Neither of these produce any errors, nor do they work. _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services www.pridedallas.com <file:///\\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
The events are just your normal DOM events minus the "on". -Thomas Am 27.06.2006 um 22:37 schrieb Keith Davis:> Where is a list of the events and why don''t they match up with the > actual event name?_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Aaarrrggh. Here''s the actual code that I need to work: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { ClearTextIfNotChecked(''assess_int9'', ''assess_int9_s0'') ''''; }); </SCRIPT> However, I did this as a test and it doesn''t work either and no error: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { alert(''test''); } ); </SCRIPT> _____________________ 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
I just realized that this works in Firefox, but not in Internet Explorer. Why would that be? 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 Keith Davis Sent: Wednesday, June 28, 2006 2:53 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Event.observe Aaarrrggh. Here''s the actual code that I need to work: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { ClearTextIfNotChecked(''assess_int9'', ''assess_int9_s0'') ''''; }); </SCRIPT> However, I did this as a test and it doesn''t work either and no error: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { alert(''test''); } ); </SCRIPT> _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services www.pridedallas.com <file://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
I figured out what the problem is. I thought JavaScript watched the ID not the name. As you can see, I''ve got a hidden input before the checkbox. That is on purpose. Since IE doesn''t send unchecked checkboxes, I had to place a hidden before the actual checkboxes to clear the values in the SQL or unchecking the box wouldn''t have any effect. This works in Firefox and until now, it worked in Internet Explorer. Is there any other way I can specify the checkbox input only? 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 Keith Davis Sent: Wednesday, June 28, 2006 2:56 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe I just realized that this works in Firefox, but not in Internet Explorer. Why would that be? 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 Keith Davis Sent: Wednesday, June 28, 2006 2:53 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Event.observe Aaarrrggh. Here''s the actual code that I need to work: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { ClearTextIfNotChecked(''assess_int9'', ''assess_int9_s0'') ''''; }); </SCRIPT> However, I did this as a test and it doesn''t work either and no error: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { alert(''test''); } ); </SCRIPT> _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services www.pridedallas.com <file://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
Actually, I think the problem is that you have 2 inputs with the same id. That is technically impossible, although Firefox tends to not complain about it (I think it just grabs the first match). IE just dies because it doesn''t know what to do. At least, that''s what I seem to remember. 2 elements are not allowed to have the same id. Same name is fine, but be advised, most server software will pack all of the values into an array, so you might be expecting a string and get an array instead. Greg ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Keith Davis Sent: Wednesday, June 28, 2006 2:01 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe I figured out what the problem is. I thought JavaScript watched the ID not the name. As you can see, I''ve got a hidden input before the checkbox. That is on purpose. Since IE doesn''t send unchecked checkboxes, I had to place a hidden before the actual checkboxes to clear the values in the SQL or unchecking the box wouldn''t have any effect. This works in Firefox and until now, it worked in Internet Explorer. Is there any other way I can specify the checkbox input only? 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 Keith Davis Sent: Wednesday, June 28, 2006 2:56 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe I just realized that this works in Firefox, but not in Internet Explorer. Why would that be? 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 Keith Davis Sent: Wednesday, June 28, 2006 2:53 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Event.observe Aaarrrggh. Here''s the actual code that I need to work: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { ClearTextIfNotChecked(''assess_int9'', ''assess_int9_s0'') ''''; }); </SCRIPT> However, I did this as a test and it doesn''t work either and no error: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { alert(''test''); } ); </SCRIPT> _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services www.pridedallas.com <file:///\\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
Hey Keith, why don''t you just change the ID in each input and leave the Name the same? Ok, Keith, I will. (Just making fun of myself for answering my own question.) 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 Keith Davis Sent: Wednesday, June 28, 2006 3:01 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe I figured out what the problem is. I thought JavaScript watched the ID not the name. As you can see, I''ve got a hidden input before the checkbox. That is on purpose. Since IE doesn''t send unchecked checkboxes, I had to place a hidden before the actual checkboxes to clear the values in the SQL or unchecking the box wouldn''t have any effect. This works in Firefox and until now, it worked in Internet Explorer. Is there any other way I can specify the checkbox input only? 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 Keith Davis Sent: Wednesday, June 28, 2006 2:56 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe I just realized that this works in Firefox, but not in Internet Explorer. Why would that be? 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 Keith Davis Sent: Wednesday, June 28, 2006 2:53 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Event.observe Aaarrrggh. Here''s the actual code that I need to work: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { ClearTextIfNotChecked(''assess_int9'', ''assess_int9_s0'') ''''; }); </SCRIPT> However, I did this as a test and it doesn''t work either and no error: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { alert(''test''); } ); </SCRIPT> _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services www.pridedallas.com <file://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
Actually, my original code doesn''t have an ID for the HIDDEN input. They have the same Name though. Strange. 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 Gregory Hill Sent: Wednesday, June 28, 2006 3:09 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe Actually, I think the problem is that you have 2 inputs with the same id. That is technically impossible, although Firefox tends to not complain about it (I think it just grabs the first match). IE just dies because it doesn''t know what to do. At least, that''s what I seem to remember. 2 elements are not allowed to have the same id. Same name is fine, but be advised, most server software will pack all of the values into an array, so you might be expecting a string and get an array instead. Greg ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Keith Davis Sent: Wednesday, June 28, 2006 2:01 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe I figured out what the problem is. I thought JavaScript watched the ID not the name. As you can see, I''ve got a hidden input before the checkbox. That is on purpose. Since IE doesn''t send unchecked checkboxes, I had to place a hidden before the actual checkboxes to clear the values in the SQL or unchecking the box wouldn''t have any effect. This works in Firefox and until now, it worked in Internet Explorer. Is there any other way I can specify the checkbox input only? 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 Keith Davis Sent: Wednesday, June 28, 2006 2:56 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe I just realized that this works in Firefox, but not in Internet Explorer. Why would that be? 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 Keith Davis Sent: Wednesday, June 28, 2006 2:53 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Event.observe Aaarrrggh. Here''s the actual code that I need to work: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { ClearTextIfNotChecked(''assess_int9'', ''assess_int9_s0'') ''''; }); </SCRIPT> However, I did this as a test and it doesn''t work either and no error: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { alert(''test''); } ); </SCRIPT> _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services www.pridedallas.com <file:///\\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
No, but the text input has the same id, at least in the code snippet you sent. That is what I was referring to. Greg ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Keith Davis Sent: Wednesday, June 28, 2006 2:13 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe Actually, my original code doesn''t have an ID for the HIDDEN input. They have the same Name though. Strange. 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 Gregory Hill Sent: Wednesday, June 28, 2006 3:09 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe Actually, I think the problem is that you have 2 inputs with the same id. That is technically impossible, although Firefox tends to not complain about it (I think it just grabs the first match). IE just dies because it doesn''t know what to do. At least, that''s what I seem to remember. 2 elements are not allowed to have the same id. Same name is fine, but be advised, most server software will pack all of the values into an array, so you might be expecting a string and get an array instead. Greg ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Keith Davis Sent: Wednesday, June 28, 2006 2:01 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe I figured out what the problem is. I thought JavaScript watched the ID not the name. As you can see, I''ve got a hidden input before the checkbox. That is on purpose. Since IE doesn''t send unchecked checkboxes, I had to place a hidden before the actual checkboxes to clear the values in the SQL or unchecking the box wouldn''t have any effect. This works in Firefox and until now, it worked in Internet Explorer. Is there any other way I can specify the checkbox input only? 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 Keith Davis Sent: Wednesday, June 28, 2006 2:56 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe I just realized that this works in Firefox, but not in Internet Explorer. Why would that be? 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 Keith Davis Sent: Wednesday, June 28, 2006 2:53 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Event.observe Aaarrrggh. Here''s the actual code that I need to work: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { ClearTextIfNotChecked(''assess_int9'', ''assess_int9_s0'') ''''; }); </SCRIPT> However, I did this as a test and it doesn''t work either and no error: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { alert(''test''); } ); </SCRIPT> _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services www.pridedallas.com <file:///\\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
Oooh, didn''t see that.That was a mistake, but surely was causing a problem like you say. thanks. 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 Gregory Hill Sent: Wednesday, June 28, 2006 3:29 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe No, but the text input has the same id, at least in the code snippet you sent. That is what I was referring to. Greg ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Keith Davis Sent: Wednesday, June 28, 2006 2:13 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe Actually, my original code doesn''t have an ID for the HIDDEN input. They have the same Name though. Strange. 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 Gregory Hill Sent: Wednesday, June 28, 2006 3:09 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe Actually, I think the problem is that you have 2 inputs with the same id. That is technically impossible, although Firefox tends to not complain about it (I think it just grabs the first match). IE just dies because it doesn''t know what to do. At least, that''s what I seem to remember. 2 elements are not allowed to have the same id. Same name is fine, but be advised, most server software will pack all of the values into an array, so you might be expecting a string and get an array instead. Greg ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Keith Davis Sent: Wednesday, June 28, 2006 2:01 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe I figured out what the problem is. I thought JavaScript watched the ID not the name. As you can see, I''ve got a hidden input before the checkbox. That is on purpose. Since IE doesn''t send unchecked checkboxes, I had to place a hidden before the actual checkboxes to clear the values in the SQL or unchecking the box wouldn''t have any effect. This works in Firefox and until now, it worked in Internet Explorer. Is there any other way I can specify the checkbox input only? 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 Keith Davis Sent: Wednesday, June 28, 2006 2:56 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Event.observe I just realized that this works in Firefox, but not in Internet Explorer. Why would that be? 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 Keith Davis Sent: Wednesday, June 28, 2006 2:53 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Event.observe Aaarrrggh. Here''s the actual code that I need to work: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { ClearTextIfNotChecked(''assess_int9'', ''assess_int9_s0'') ''''; }); </SCRIPT> However, I did this as a test and it doesn''t work either and no error: <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> : <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> Event.observe(''assess_int9'', ''click'', function() { alert(''test''); } ); </SCRIPT> _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services www.pridedallas.com <file:///\\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
Just FYI, the duplicate names can cause issues too, but in IE. In IE, getElementById really means getElementByIdOrName...so if you have (for example) a label with a name "username" and a textbox with an id "username", whichever one comes first in the DOM will be picked up by IE. -Jerod Venema On 6/28/06, Keith Davis <keithdavis-mQJYS7++JhLwMB+CN6uaIQ@public.gmane.org> wrote:> > Oooh, didn''t see that.That was a mistake, but surely was causing a problem > like you say. thanks. > > > 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 Gregory Hill > Sent: Wednesday, June 28, 2006 3:29 PM > > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] Event.observe > > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On > Behalf Of Gregory Hill > Sent: Wednesday, June 28, 2006 3:29 PM > > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] Event.observe > > > > > No, but the text input has the same id, at least in the code snippet you > sent. That is what I was referring to. > > > > Greg > > > > ________________________________ > > > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On > Behalf Of Keith Davis > Sent: Wednesday, June 28, 2006 2:13 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] Event.observe > > > > Actually, my original code doesn''t have an ID for the HIDDEN input. They > have the same Name though. Strange. > > > > > 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 Gregory Hill > Sent: Wednesday, June 28, 2006 3:09 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] Event.observe > > Actually, I think the problem is that you have 2 inputs with the same id. > That is technically impossible, although Firefox tends to not complain about > it (I think it just grabs the first match). IE just dies because it doesn''t > know what to do. At least, that''s what I seem to remember. 2 elements are > not allowed to have the same id. Same name is fine, but be advised, most > server software will pack all of the values into an array, so you might be > expecting a string and get an array instead. > > > > Greg > > > > ________________________________ > > > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On > Behalf Of Keith Davis > Sent: Wednesday, June 28, 2006 2:01 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] Event.observe > > > > I figured out what the problem is. I thought JavaScript watched the ID not > the name. As you can see, I''ve got a hidden input before the checkbox. That > is on purpose. Since IE doesn''t send unchecked checkboxes, I had to place a > hidden before the actual checkboxes to clear the values in the SQL or > unchecking the box wouldn''t have any effect. This works in Firefox and until > now, it worked in Internet Explorer. Is there any other way I can specify > the checkbox input only? > > > > > 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 Keith Davis > Sent: Wednesday, June 28, 2006 2:56 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] Event.observe > > I just realized that this works in Firefox, but not in Internet Explorer. > Why would that be? > > > > > 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 Keith Davis > Sent: Wednesday, June 28, 2006 2:53 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: [Rails-spinoffs] Event.observe > > Aaarrrggh. Here''s the actual code that I need to work: > > <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> > <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" > CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> > > : > <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" > STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> > <SCRIPT LANGUAGE="JAVASCRIPT" > TYPE="TEXT/JAVASCRIPT"> > Event.observe(''assess_int9'', ''click'', > function() { ClearTextIfNotChecked(''assess_int9'', > ''assess_int9_s0'') = ''''; }); > > </SCRIPT> > > > > However, I did this as a test and it doesn''t work either and no error: > > <INPUT TYPE="HIDDEN" NAME="assess_int9" VALUE=""> > <INPUT TYPE="CHECKBOX" NAME="assess_int9" VALUE=":" > CHECKED="CHECKED" CLASS="radiocheck" ID="assess_int9"> > > : > <INPUT TYPE="TEXT" NAME="assess_int9_s0" CLASS="" > STYLE="" ID="assess_int9" VALUE="sfsadfsdf"> > <SCRIPT LANGUAGE="JAVASCRIPT" > TYPE="TEXT/JAVASCRIPT"> > Event.observe(''assess_int9'', ''click'', > function() { alert(''test''); } ); > </SCRIPT> > > _____________________ > 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 > > >
On Wednesday 28 June 2006 13:00, Keith Davis wrote:> I figured out what the problem is. I thought JavaScript watched the ID > not the name.err... well document.getElementById() on any *sane* browser uses the ID attribute. on IE, it uses the name as well. Go figure. 2 + 2 = 5 for very long values of 2! -Jeremy -- Jeremy Kitchen ++ kitchen-RA8HwDor7flnDGu+y90WmgC/G2K4zDHf@public.gmane.org http://www.pirate-party.us/ -- defend your rights _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Is there any way to pass Prototype''s Event.observe an array of elements, e.g. an array returned by something like getElementsByClassName? Yahoo!''s YUI allows adding of event handlers to multiple elements but so far I have had no success with Prototype Thanks, Owen Thomas Fuchs wrote:> The events are just your normal DOM events minus the "on". > > -Thomas > > > Am 27.06.2006 um 22:37 schrieb Keith Davis: > >> Where is a list of the events and why don''t they match up with the >> actual event name? > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
[''element1'',''element2'',''element3''].each(function(e){ Event.observe(e, ''click'', mycallback.bindAsEventListener()); }); hth On 7/18/06, Owen Franssen <owen-fHxLqwHf0PytTk9+fKAAsaxOck334EZe@public.gmane.org> wrote:> > Is there any way to pass Prototype''s Event.observe an array of elements, > e.g. an array returned by something like > getElementsByClassName? > Yahoo!''s YUI allows adding of event handlers to multiple elements but so > far I have had no success with Prototype > > Thanks, > Owen > > Thomas Fuchs wrote: > > The events are just your normal DOM events minus the "on". > > > > -Thomas > > > > > > Am 27.06.2006 um 22:37 schrieb Keith Davis: > > > >> Where is a list of the events and why don''t they match up with the > >> actual event name? > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > 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 >-- Mit freundlichen Grüßen Siegfried Puchbauer _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Great! thats exactly what I wanted, thanks Siegfried. Siegfried Puchbauer wrote:> [''element1'',''element2'',''element3''].each(function(e){ Event.observe(e, > ''click'', mycallback.bindAsEventListener()); }); > > hth > > On 7/18/06, *Owen Franssen* <owen-fHxLqwHf0PytTk9+fKAAsaxOck334EZe@public.gmane.org > <mailto:owen-fHxLqwHf0PytTk9+fKAAsaxOck334EZe@public.gmane.org>> wrote: > > Is there any way to pass Prototype''s Event.observe an array of > elements, e.g. an array returned by something like > getElementsByClassName? > Yahoo!''s YUI allows adding of event handlers to multiple elements > but so far I have had no success with Prototype > > Thanks, > Owen > > Thomas Fuchs wrote: > > The events are just your normal DOM events minus the "on". > > > > -Thomas > > > > > > Am 27.06.2006 um 22:37 schrieb Keith Davis: > > > >> Where is a list of the events and why don''t they match up with the > >> actual event name? > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > <mailto:Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > <http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs> > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > <mailto:Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > > -- > Mit freundlichen Grüßen > > Siegfried Puchbauer > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs