Hi Guys
I'm having some problems getting a custom event to fire using the following
code
Event.observe(window,'load', function(e){
initCustomField($('customFieldForm'));
document.observe('CustomField:TypeChanged',function(e){
alert('event');
var optionsField = $('OptionsField');
if(e.target.value == 4) optionsField.show();
else optionsField.hide();
});
});
function initCustomField(customFieldForm)
{
//var panel = customFieldForm.down('.customFieldPanel');
//initCustomFieldOptionPanel(panel);
$$('input[type=radio][name^=CustomFieldType]').each(function(radio){
radio.observe('click', function(e){
this.fire('CustomField:TypeChanged');
});
}).find(function(radio){ return radio.checked; }).fire(
'CustomField:TypeChanged');
}
When I click a radio button, the event fires and all is well, but i'm trying
to also fire the event on the (server selected) radio button on page load.
Can anyone see what I've done wrong?
Gareth
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---