drupal adding onchange event to node form
- by Arun
hi i need to know how to add attribute onchange to a custom content_type field?
For ex my content_type has 2 fields phone (name:field_phone[0][value], id:edit-field-phone-0-value),email (name:field_email[0][value], id:edit-field-email-0-value). i'm unable to add attribute as follows.
function knpevents_form_event_node_form_alter(&$form, &$form_state) {
$form['title']['#attributes'] = array('onchange' => "return titlevalidate(0)");//fine
$form['field_evt_org[0][value]']['#attributes']= array('onchange' => "return organiservalidate(0)"); //error
$form['field_evt_org[0][value]']['#attributes']= array('onchange' => "return organiservalidate(0)"); //error
}
how to add it