When adding a textfield to a form using ctools ajax, the default value does not get set.
This bug doesn't occur using the core fapi functions, because drupal_rebuild_form clears $form['#post'], which is checked for in _form_builder_handle_input_element(). When using ctools_rebuild_form, $form['#post'] persists and it passes through this conditional in _form_builder_handle_input_element():
if (($form['#programmed']) || ((!isset($form['#access']) || $form['#access']) && isset($form['#post']) && (isset($form['#post']['form_id']) && $form['#post']['form_id'] == $form_id))) {
$edit = $form['#post'];
foreach ($form['#parents'] as $parent) {
$edit = isset($edit[$parent]) ? $edit[$parent] : NULL;
}
If there isn't a POST value for the textfield, $edit gets set to NULL.
In form_type_textfield_value(), the default value only gets set when $edit is FALSE, so the textfield never gets it's default value.
It appears that this was discovered in Drupal 7, and a check for NULL was added in this thread:
http://drupal.org/node/335035#comment-2615976
The attached patch adds a check for NULL to D6.
| Comment | File | Size | Author |
|---|---|---|---|
| textfield_default_value.patch | 768 bytes | msonnabaum |
Comments
Comment #1
dkinzer commented