【发布时间】:2014-07-19 21:47:16
【问题描述】:
我的自定义模块中有一个字段
$form['update']['text'] = array(
//'#type' => 'textarea',
'#type' => 'text_format',
如果我使用 textarea 一切正常,但如果我使用 text_format,我的 ajax 回调不会更改字段的值。
function maintenance_update_form_update_callback($form, $form_state) {
$entry = $form_state['entries'][$form_state['values']['aid']];
// Setting the #value of items is the only way I was able to figure out
// to get replaced defaults on these items. #default_value will not do it
// and shouldn't.
dpm($form_state['entries'][$form_state['values']['aid']]);
foreach (array('status', 'type', 'title', 'text', 'name', 'email', 'phone', 'notes') as $item) {
$form['update'][$item]['#value'] = $entry->$item;
//dpm($entry);
//drupal_set_message("entry->item értéke: ENTRY: $entry, ITEM: $item , $entry->$item");
}
这个字段有什么问题?据我所知,这种类型也支持 ajax 请求......
//drupal_set_message('Callback $form');
dpm($form);
return $form;
}
【问题讨论】:
标签: ajax forms api drupal field