Hey Aaron,
MAN, I must document this! This has tripped up lots of people.
Image submit buttons are handled differently in the HTML spec. Simple submit buttons sent along a name-value pair corresponding to the button that was clicked; image buttons don't: they pass along some X & Y coordinates with the submit name attribute as the prefix. I'm not entirely sure this is consistent across browsers, either...
Anyway, to use a image submit button in an API form (POST forms are fine), you need to let the ft_api_process_form() function know that the form has been submitted by specifying a different form field - one that you know will always be included on the POST request.
So, add this to your form:
Then, in your API code at the top of the page, use the "is_submitted" hidden field as the fake submit button.
In retrospect, the "submit_button" key wasn't named very well: I didn't take into account this situation with image submit buttons. I should have called it something like "form_submit_includes_key" or something more generic. Oh well. In the code, all it's doing is checking to confirm that the POST request includes that name-value pair. If it IS, it processes the form. Otherwise it ignores it.
Anyway, hope this helps! Let me know if you run into any other problems.
- Ben
MAN, I must document this! This has tripped up lots of people.
Image submit buttons are handled differently in the HTML spec. Simple submit buttons sent along a name-value pair corresponding to the button that was clicked; image buttons don't: they pass along some X & Y coordinates with the submit name attribute as the prefix. I'm not entirely sure this is consistent across browsers, either...
Anyway, to use a image submit button in an API form (POST forms are fine), you need to let the ft_api_process_form() function know that the form has been submitted by specifying a different form field - one that you know will always be included on the POST request.
So, add this to your form:
Code:
<input type="hidden" name="is_submitted" value="1" />
Then, in your API code at the top of the page, use the "is_submitted" hidden field as the fake submit button.
PHP Code:
$params = array(
...
"submit_button" => "is_submitted",
...
);
In retrospect, the "submit_button" key wasn't named very well: I didn't take into account this situation with image submit buttons. I should have called it something like "form_submit_includes_key" or something more generic. Oh well. In the code, all it's doing is checking to confirm that the POST request includes that name-value pair. If it IS, it processes the form. Otherwise it ignores it.
Anyway, hope this helps! Let me know if you run into any other problems.
- Ben