I have a form using the CTools wizard api, and it is designed to use images for the form buttons.

On the first and last step, there is only one button (Next, and Complete).

The second step has two buttons, Back and Next.

I altered both like so:

$form['buttons']['previous']['#type'] = 'image_button';
$form['buttons']['previous']['#src'] = drupal_get_path('module', 'custom_registration') . '/images/back.gif';
$form['buttons']['next']['#type'] = 'image_button';
$form['buttons']['next']['#src'] = drupal_get_path('module', 'custom_registration') . '/images/continue.gif';

Which makes the inputs into buttons with an image. I am doing this all over the site with no issue except for this page.

When I click Next on this step, my form_submit callback is skipped over completely. The form_validate is still called. I could see this by putting an exit inside of the submit function and it never dropped out, only when I commented out the above $form code did it get inside the form_submit.

Has anyone experienced this? Is there a way I can work around/ patch something to make this work?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Ashlar’s picture

Status: Active » Closed (won't fix)

This bug report has not been active for over six months. In an effort to clean-up the issue queue this item has been closed. If your modules are current and the report is still relevant please feel free to change the Status back to active.

frankcarey’s picture

Issue summary: View changes
Status: Closed (won't fix) » Active

Yeah, I just ran across this myself. I have a form that was working fine until I put it into a ctools modal. It looks like the issue is that modal.js doesn't set the handler on input[type=image], and only looks for $('image[submit], button'). As a result, no form data for image buttons is submitted when they are clicked. Image buttons are generally a PITA because they don't take a value and you need to look for the details in $form_state['triggering_element'], but that wasn't the cause here. The issue description seems to confirm the issue where if you change a submit button into an image button, things break for ctools modals.

I'll follow up with a patch.

frankcarey’s picture

Version: 6.x-1.8 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
532 bytes

Here is the patch.

Chris Matthews’s picture

The patch in #3 to modal.js applied cleanly to the latest ctools 7.x-1.x-dev and if still applicable needs to be reviewed.

Checking patch js/modal.js...
Hunk #1 succeeded at 256 (offset 1 line).
Applied patch js/modal.js cleanly.