Seems in 5.2 you can't submit a form for normal processing from a element, only elements appear to work. I wanted the button tag because it allows much more css styling flexibility than the input tag. So, after too many hours to mention trying to make the api do what I wanted to do I decided to delve into form.inc

# changes to form.inc in function form_builder($form_id, $form):
# lines 746, 747:
if ((isset($form['#post'][$form['#name']]) && $form['#post'][$form['#name']] == $form['#value'])
|| !(strpos($form['#value'], "submit") === FALSE)) {

# and line 659
if ((isset($form['#input']) && $form['#input']) || isset($form['#submitbutton'])) {

# so then we can write

$form['submit'] = array (
'#prefix' => '

',
'#suffix' => '

',
'#submitbutton' => TRUE,
'#executes_submit_callback' => TRUE,
'#value' => 'Search',
);

# in our forms, and its works as expected. there's no doubt a much more elegant way of implementing
# this behavior so you can say '#type' => 'submitbutton' and it just works, but the above works well
# enough for me.

Comments

joehudson’s picture

doh! tags got striped from the 1st sentence :) :-
Seems in 5.2 you can't submit a form for normal processing from a 'button type="input"' element, only 'input' elements appear to work ...

sun’s picture

Status: Active » Closed (works as designed)

This is the expected behavior for D5.