Button with Drupal Behavior jQuery Conflicting with AJAX 'Add More' Button on Unlimited Cardinality Field I have a form with an unlimited cardinality field that creates an 'Add more' button to add more fields. I also have a separate pair of fields. One of these fields has a value prepopulated on starting a new form, the other field is another unlimited cardinality field with an 'Add more' button &amp; is blank on page load. I have attached a Drupal Behavior jQuery function to a button that I have added in a custom module with hook_form_alter: this jQuery sets the value of the second of the pair of fields to the value of the first when the custom button is clicked. This works. And the 'Add More' buttons for the unlimited cardinality fields work as well. However, after the custom button has been clicked once, the 'Add More' button will no longer create a new field, &amp; I get the following errors in my logs:

Apr 25 02:56:36 lucifer drupal: https://somesite.com|1366880196|php|111.111.111.111|https://somesite.com/system/ajax|https://somesite.com/node/add/inventory-stocking-ticket|1||Warning: implode(): Invalid arguments passed in form_error() (line 1649 of /hosting/somesite/com/htdocs/cms_sandbox/includes/form.inc).

Apr 25 02:56:41 lucifer drupal: https://somesite.com|1366880201|php|111.111.111.111|https://somesite.com/system/ajax|https://somesite.com/node/add/inventory-stocking-ticket|1||Notice: Undefined index: #ajax in ajax_form_callback() (line 379 of /hosting/somesite/com/htdocs/cms_sandbox/includes/ajax.inc).

Here is my code for the custom button:

$form['field_ending_weight_garbage']['und']['garbage_no_change'] = array(
  '#type' =&gt; 'button',
  '#value' =&gt; t('No Change'),
  '#attributes' =&gt; array('onclick' =&gt; 'return (false);'),
  '#name' =&gt; 'garbagenochange',
);


And the code for the behavior:

(function ($) {
  Drupal.behaviors.noChange = {
    attach: function (context, settings) {
     $('#edit-field-ending-weight-garbage-und-garbage-no-change').once('noChange', function() {
      $('#edit-field-ending-weight-garbage-und-garbage-no-change', context).click(function () {
     var a = $('#edit-field-starting-weight-garbage-und-0-value').val();
     var b = $('#edit-field-ending-weight-garbage-und-0-value').val();
     if (b == "")
     {
       $('#edit-field-ending-weight-garbage-und-0-value').val( a );
     }
     else
     {
       $('#edit-field-ending-weight-garbage-und-0-value').select();
     }
        return false;
      });
    });
   }
  };
}(jQuery));


Which is attached in an after_build function like so:

drupal_add_js(drupal_get_path('theme', 'corolla').'/js/inventoryNoChange.js');


I'm using jQuery 1.5 by means of jQuery Update module, uncompressed. What could be causing this?

Edit: I've managed to eliminate the first error by adding the custom button like this:

$form['field_starting_weight_garbage']['und'][0]['garbage_no_change'] = array(
  '#type' =&gt; 'button',
  '#value' =&gt; t('No Change'),
  '#attributes' =&gt; array('onclick' =&gt; 'return (false);'),
    '#limit_validation_errors' =&gt; array(),
  '#name' =&gt; 'garbagenochange',
);


So, it's on the first field in the pair rather than the second, &amp; it's at $form['field_starting_weight_garbage']['und'][0]['garbage_no_change'] rather than $form['field_starting_weight_garbage']['und']['garbage_no_change'].

But the ajax error persists, &amp; the 'Add Another' functionality is still broken. I should note that it only throws the error &amp; fails seemingly randomly. I can add several extra fields with the 'Add Another' button, but then it breaks, throws the error, &amp; won't add more fields.

I've determined that it is not the Behavior/jQuery that is breaking things. Simply adding the custom button with no behavior attached to it causes the problem. Still hoping someone can shed some light on this.
So I went with a different approach to achieve the same thing. Instead of adding a button using the '#button' or '#submit' property in hook_form_alter, which was causing the conflict, I added a button with the following code:

$form['field_starting_weight_garbage']['und'][0]['value']['#prefix'] = '&lt;div&gt;';
$form['field_starting_weight_garbage']['und'][0]['value']['#suffix'] = '&lt;input type="submit" value="No Change" class="form-submit" id="garbagenochange"&gt;&lt;/div&gt;';


&amp; adjusted the Drupal Behavior to attach to this element (id="garbagenochange").

I still don't know exactly what was causing the conflict or how to fix it, but this does what I need, so I'll go this route.