我已經使用Drupal 6和AHAH來定製我的節點表單。對於AHAH我用這個代碼:如何在AHAH後停止節點表單驗證
function mymodule_subtopic_type() {
$output = '';
$form_state = array('storage' => null, 'submitted' => false, 'rebuild' => true);
$form_build_id = $_POST['form_build_id'];
$form = form_get_cache($form_build_id, $form_state);
$args = $form['#parameters'];
$form_id = array_shift($args);
$form_state['post'] = $_POST;
$form['#post'] = $_POST;
$form['#programmed'] = false;
$form['#redirect'] = false;
drupal_process_form($form_id, $form, $form_state);
$form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
$topic_form = $form['topic_wrapper'];
unset($topic_form['#prefix'], $topic_form['#suffix']);
$output .= theme('status_messages');
$output .= drupal_render($topic_form);
drupal_json(array('status' => TRUE, 'data' => $output));
}
新形式元素呈現細,但我得到的狀態消息:
- Title字段是必需的。
- 說明字段是必需的。
如何在呼叫後停止驗證?從d.o: