I have a simple Drupal form in a custom module where exiting a textfield
should retrieve some information about the entered text via ahah
to populate a div
.
This works fine, except if the user quickly submits the form while the textfield's ahah event is being processed.
It looks like while the ahah event is being processed the textfield is disabled, which of course means it's value is not submitted. This means validation fails as the textfield is a required field, so the user is returned to the form with an appropriate error. The textfield is always empty when this happens.
If the user waits for the event to finish, the textfield returns to being enabled and submitting works as expected, as does submitting by using the enter key while in the textfield (the event doesn't fire then, so the textfield isn't disabled while it retrieves data).
Is there a way to disable the disabling of the textfield while it's ahah event is being processed, or some other workaround?
Example of the textfield:
$form['id'] = array(
'#type' => 'textfield',
'#title' => t('Crop No.'),
'#default_value' => $crop['id'] ? $crop['id'] : '',
'#size' => 6,
'#disabled' => $disabled,
'#ahah' => array(
'path' => 'spcs-myspuds/yields/js/crop/description/' . $crop_idx,
'wrapper' => 'spcs-myspuds-yields-edit-crop-description-row-' . $crop_idx,
'effect' => 'fade',
'progress' => array(
'type' => 'none',
),
),
);
Thanks in advance for any help.