prevent submit in ajax call I have a form  with 2 submit in it, one of them is a button to generate codes, everytimes I click on generate form_submited called up and a record insert in db, how can I prevent form_sumit in ajax triggering?

function rah_cc_generate_form($form,$form_state){
    $form=array();

    $form['gen']=array(
        '#type' =&gt; 'fieldset',
        '#name' =&gt;t('generate gift card code'),
        '#collapsible' =&gt; TRUE,
        '#collapsed' =&gt; false,
//        '#weight' =&gt; 5,

    );
    $form['gen']['code']=array(
            '#type' =&gt; 'textfield',
            '#title' =&gt; t('gift code'),
            '#default_value' =&gt; '',
            '#prefix' =&gt; '&lt;div id="gc-code"&gt;',
            '#suffix' =&gt; '&lt;/div&gt;',
            '#size' =&gt; variable_get('rah_gc_code_size', 8),
            '#maxlength' =&gt; 20,
            //'#required' =&gt; TRUE,
    );
    $form['gen']['price']=array(
            '#type' =&gt; 'textfield',
            '#title' =&gt; t('price'),
            '#default_value' =&gt; 10000,
            '#size' =&gt; 10,
            '#maxlength' =&gt; 20,
            '#required' =&gt; TRUE,
    );
    $form['gen']['status'] = array(
  '#type' =&gt; 'checkbox',
  '#title' =&gt; t('status'),
    '#default_value' =&gt; 1,
);

    $form['gen']['random']=array(
     '#type' =&gt; 'submit',
    '#value' =&gt; t('generate'),
    '#description' =&gt; t("if you want generate random use this plz"),
    //'#weight' =&gt; 1,
    //'#submit' =&gt; array('rah_cc_generate_random'), // If no javascript action.
    '#ajax' =&gt; array(
      'callback' =&gt; 'rah_cc_generate_ajax',
      'wrapper' =&gt; 'gc-code',
      'method' =&gt; 'replace',
      'effect' =&gt; 'fade',
      ),
   );


    $form['gen']['save']=array(
        '#type' =&gt; 'submit',
        '#value' =&gt;t('save'),
         );
    ym($form);    
    return $form;


}
function rah_cc_generate_ajax(&amp;$form,$form_state){

    //return $form['gen']['code']['#default_value']=33;
     $form['gen']['code']['#value']=rah_cc_generate();
     //$form_state['values']['code']['und'][0]['value']=44;
     return $form['gen']['code'];

}


update
I use      'prevent'=&gt; 'sumbit', but not get answer :(

 $form['gen']['random']=array(
     '#type' =&gt; 'submit',
    '#value' =&gt; t('generate'),
    '#description' =&gt; t("if you want generate random use this plz"),
    //'#weight' =&gt; 1,
    //'#submit' =&gt; array('rah_cc_generate_random'), // If no javascript action.
    '#ajax' =&gt; array(
      'callback' =&gt; 'rah_cc_generate_ajax',
      'wrapper' =&gt; 'gc-code',
      'method' =&gt; 'replace',
      'effect' =&gt; 'fade',
      'prevent'=&gt; 'sumbit',
      ),
   );
$form_state variable holds 'triggering_element' element which indicates what button triggered (or also you can use #clicked_button element), example (in ajax callback function):

function my_form_submit($form, &amp;$form_state) {
  //dpm($form_state);
  if($form_state['triggering_element']['#value'] == 'MY_ELEMENT\'S_NAME') {
    //do_operation();
  }
}