According to the help text:
A list of form IDs. One form ID per line. Also, you can specify buttons which should be handled (for eaxmple: article_node_form@save+preview) or buttons which shouldn't be handled (article_node_form@-delete).

The @ button syntax has no effect. For instance, if i do: article_node_form@save, none of the buttons are ajaxified. If i do article_node_form@-delete, all of the buttons are still ajaxified.

A side note.... the word "example" in the help text above is misspelled.

Comments

taldy’s picture

Hello apmsooner,

Please ensure that save button is placed in fisrt level of form structure. Because if it's usual node form their buttons usualy is placed in the 'actions' group. In this case you should use:
article_node_form@actions][save
and
article_node_form@-actions][delete

apmsooner’s picture

@taldy,

maybe theres a typo in what you pasted or I'm still not understanding the syntax. My buttons are standard node output like so:
<div id="edit-actions" class="form-actions form-wrapper"><input type="submit" class="form-submit" value="Save" name="op" id="edit-submit"><input type="submit" class="form-submit" value="Preview" name="op" id="edit-preview"><input type="submit" class="form-submit" value="Delete" name="op" id="edit-delete"></div>

The example provided in the module help assumes the form is node so I'm confused whats the correct syntax...

taldy’s picture

Status: Active » Closed (works as designed)

Hello apmsooner,

Form structure in Drupal is tree-like. And in theory form could contain several buttons with the name 'save' but in different branches of form tree. To split buttons with the same name you should specify whole path to the button in form tree with ][ separator between levels.

In your exact case submit and delete buttons are placed in 'actions' group. So you need the followin code:

article_node_form@actions][submit

if you want ajaxify only Save button (in this case submit is a machine-name of Save button), and

article_node_form@-actions][delete

if you want to ajaxify all buttons except Delete button.

It's not so easy to understand real names of buttons and their full paths by looking to the HTML, but you always can print real structure of form and find it there. You can do this by following code in your module/theme:

function HOOK_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'article_node_form') {
    dsm($form);
  }
}

Maybe in future I should make checkbox like "Show form buttons" which will show all buttons with their full paths like "Show form ids" currently shows form ids.

taldy’s picture

I forgot to say that you need Devel module for the 'dsm' function. Or use

print_r('<pre>');
print_r($form);
print_r('</pre>');

instead of dsm($form). But dsm() is much more useful way for the big structures.

apmsooner’s picture

There we go. Got it to work now with your example. You might want to update the documentation on the module page as well as the help text displayed in the ui screen as the node form example won't work unless doing it this way.