>Ajax Module With Image Button Drupal

Posted: June 8, 2011 in Drupal

>

If you are using Ajax module for Drupal Forms which having image button, then you can not submit the form.
To fix that kind of issue then we have to use  ‘#button_type’ => ‘submit ajax-trigger’, attribute to submit button. Below is the sample code…

$path = drupal_get_path(‘theme’, ‘tradenet’).’/images/image_button.png’;
      $form[‘#ajax’] = array(
        ‘enabled’ => TRUE
      );
      $form[‘submit’] = array(
             ‘#type’ => ‘image_button’,
             ‘#access’ => 1,
             ‘#button_type’ => ‘submit ajax-trigger’,
             ‘#src’=>$path,
             ‘#ajax’ => array(‘submitter’ => TRUE ),

            
          );

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s