I have a form containing one textfield only, and the expected behavior is that when user presses enter while in the text box the value of the text box should get submitted, but without re-page (refresh) load. I have tried various ways of setting AHAH but still unable to achieve the expected behavior, the page reloads. I have searched for any solution to this problem without luck.
Please advice how it has to be done or direct me somewhere useful Here is code:
function user_porfile_message_form(){
$form = array();
$form['element1'] = array(
'#type' => 'textfield',
'#title' => '',
'#default_value' => '',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#attributes' => array('class' => 'no-js'),
'#ahah' => array(
'path' => 'module/file/callback',
'wrapper' => 'some-wrapper',
'event' => 'click',
),
);
return $form;
}