Allow me to elaborate.
I have created a form field module. Its a simple select box with a custom query to populate its options.
it is set to "unlimited" values in my content type, so i can "add new item" and order them.
This works perfect.
What im trying to do is add a onchange event to each select box so using jquery i can display details about the selected option (each option references some other node on the site).
Can someone point me in the right direction?
thanks
If I remember correctly, I added js in the head (or a .js file), that on load, set the onchange of the form element.
This allowed me to add the js w/o changing the form markup.
I think you can also use the [#attributes] for the form element. $form['myelementid']['#attributes'] = array('onchange' => 'myJsFunction();');
which will put the onclick inline. <select id="myelementid" onchange="myJsFunction();"> ... </select>
I have created a cck field. In the node-form it is a select box, and i want to include a onchange event for the field. I tried to include using '#attributes" but it doesnt work out for me.
The code :
$form['field_first_level_category']['#attributes'] = array('onchange' => 'retrieveNextLevel();');
I am using '#attribute' to pass php values to js function.
I want to add this attribute, but I don't know where!
would you please inform me exactly where can I add this $form['myelementid']['#attributes'] = array('onchange' => 'myJsFunction();');
I am needing to select checkboxes on event 'hover' or 'mousedown' so that a user can click and drag the mouse over checkboxes which will then be checked/unchecked.
Comments
Allow me to elaborate. I
Allow me to elaborate.
I have created a form field module. Its a simple select box with a custom query to populate its options.
it is set to "unlimited" values in my content type, so i can "add new item" and order them.
This works perfect.
What im trying to do is add a onchange event to each select box so using jquery i can display details about the selected option (each option references some other node on the site).
Can someone point me in the right direction?
thanks
Did you get any answer ?
Hi,
Did you get any solution for this, if possible please share :-)
regards,
KV
If I remember correctly, I
If I remember correctly, I added js in the head (or a .js file), that on load, set the onchange of the form element.
This allowed me to add the js w/o changing the form markup.
I think you can also use the [#attributes] for the form element.
$form['myelementid']['#attributes'] = array('onchange' => 'myJsFunction();');which will put the onclick inline.
<select id="myelementid" onchange="myJsFunction();"> ... </select>http://api.drupal.org/api/file/developer/topics/forms_api_reference.html...
http://docs.jquery.com/Main_Page
subscribing
subscribing
Need your help
I have created a cck field. In the node-form it is a select box, and i want to include a onchange event for the field. I tried to include using '#attributes" but it doesnt work out for me.
The code :
$form['field_first_level_category']['#attributes'] = array('onchange' => 'retrieveNextLevel();');
I am using '#attribute' to pass php values to js function.
Could any one please help me to get it done?
Re:...
Sorry there is a question:
I want to add this attribute, but I don't know where!
would you please inform me exactly where can I add this $form['myelementid']['#attributes'] = array('onchange' => 'myJsFunction();');
Conditional field
You can define conditional field from cck and select the conditional filed from lest of field on add form.
I am needing to select
I am needing to select checkboxes on event 'hover' or 'mousedown' so that a user can click and drag the mouse over checkboxes which will then be checked/unchecked.
Can anyone help me with this?