I have a feeling this is actually a core problem, but if a form adds a submit callback in $form['#submit'] then passes the form to apachesolr_settings_form() the submit callback will not be called.

I have attached a patch that addresses this (albeit in a not so elegant manner).

Comments

elliotttf’s picture

StatusFileSize
new595 bytes
pwolanin’s picture

Is this a change to how core worked in 6?

I thought top-level #submit functions were always called.

Also, not so sure about this patch - typically I'd call apachesolr_settings_form() and then add any additional handlers after the buttons are defined.

elliotttf’s picture

Good question...

The issue appears to be that the form's #submit callbacks are not firing when the button is handling the #submit

I believe this is how it worked in D6 and in fact it might even be desirable to work that way if for example your submit button should hijack the normal flow of form submission and do something else (like attach a file...).

If that's the case then adding custom submit callbacks afterwards might not fix the problem.

pwolanin’s picture

Ok, so I think the basic answer is that your form builder should call the helper function and then add its submit function onto any buttons where it's relevant.

I don't think this helper should be concerned with a top-level #submit, since it has no way of knowing if it's relevant for all buttons, and any code calling this function will know that buttons with #submit properties are created.

elliotttf’s picture

StatusFileSize
new797 bytes

Ok, here's a reworked patch that addresses the original issue then.

pwolanin’s picture

Status: Needs review » Closed (won't fix)