Simulated click on "add more value" button of multi value cck field causes whole content form to sub

Posted by ninja on Stack Overflow See other posts from Stack Overflow or by ninja
Published on 2010-05-07T12:11:03Z Indexed on 2010/05/07 12:48 UTC
Read the original article Hit count: 312

Filed under:
|
|
|

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

----Update ---- This is the code I was using:-

$('#edit-field-freightamount-0-value').click(function(){

alert('hello');

$('#edit-field-supp-quan-field-supp-quan-add-more').trigger('click');

//$('.form-submit ahah-processed').trigger('click');

});

I actually intended to call this from inside some other function but I just wanted to test it before that . So i wrote this dummy function which is like if i click inside a texrfield it should simulate a click on "add more item"

How do we prevent default action of click?

© Stack Overflow or respective owner

Related posts about cck

Related posts about drupal