I have a form in a custom Drupal 6 module built with the Form API, it has 1 or more image_button elements in a list followed by the Save and Cancel buttons.
Everything is working fine when clicking the image and standard buttons, they call the submit functions they should, but if I hit the [ENTER] key within any of the text fields in the form the first button in the form is submitted, which unfortunately in this case is an image_button in the list rather than the Save button.
This is a standard problem with web forms, you generally have to hack in a hidden (by style and/or size) button early in the form definition to ensure the default submit path is called (in this case that's what the Save button will call) rather than the submit path for the buttons that are before the button you want to be the default.
Is there some Drupal 6 magic that enables setting a default button regardless of where it is in the form definition that I've failed to find in the docs, or should I create a phantom submit button that is styled to not be visible?
Thanks in advance for any answers.