Title: Event.observe

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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Keith Davis
Sent: Tuesday, June 27, 2006 3:22 PM
To: rails-spinoffs@lists.rubyonrails.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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gregory Hill
Sent: Tuesday, June 27, 2006 2:12 PM
To: rails-spinoffs@lists.rubyonrails.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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Keith Davis
Sent: Tuesday, June 27, 2006 1:08 PM
To: Rails-spinoffs@lists.rubyonrails.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
Work (214) 351-6600 ext. 119
Mobile (214) 906-5183

 

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to