By nikhiljha on
Hi I have a multi value cck field in my cck content type. I want to simulate click on "add another item" using jquery. which is like
$('#edit-field-supp-quan-field-supp-quan-add-more').trigger('click');
but it causes whole content form to submit instead of adding extra multi value cck field.
Manuall clicks are working perfectly. Can anyone tell me why behavior of manual clicks and simulated clicks are different.
thanks
Comments
The add more button listens to mousedown
Hi,
I wanted to do the same thing some time ago and realized that the add more button is bound to the mousedown event. So if you do
$('#edit-field-supp-quan-field-supp-quan-add-more').trigger('mousedown');
you should have more luck.
thank you,
thank you, auth.
$('#edit-field-supp-quan-field-supp-quan-add-more').trigger('mousedown'); works fine
Is this the whole code? I
Is this the whole code? I tried to use this also but I just can get it to work.
This is my code in module_form_alter function:
I also tried this code which works fine:
Any ideas?
I tried this code with
I tried this code with firebug and it works. So my next question is where can I put this code to make it work? I tried in module_form_alter and also in $form['#after_build'] function but it is not working.
Subscribe
hello all,
I have the same problem. Where can I put this kind of code ?
Thanks !
Drupal 7
Old thread, but I had to use
$('#add-more-id').mousedown();to successfully trigger the "add another item" to a field.
These didn't work:
and next issue: i need to
and next issue: i need to trigger this button twice, if i just add code twice i will have only one added fieldset, but i want to add it twice, maybe i need some delay between 1st and second call?
now i use <?php
now i use
this work, but there is too long delays, small delays not working
maybe exist trigger that called after drupal ahah request complete?
you need to add the click event to the ajax event list...
... for some reason, in your hook_*_form_alter