Drupal Form:want to show previous form value as default_value on page

后端 未结 8 1575
春和景丽
春和景丽 2020-12-31 20:57

My Goal is if user is submitting this form with \"Product Name\" value as \"YYY\". On submit page should reload but this time \"Product Name\" should show previous valye as

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-31 21:46

    For anyone looking for an answer here while using webform (which I just struggled through), here's what I ended up doing:

    //in hook_form_alter
    $form['#submit'][] = custom_booking_form_submit;
    
    function custom_booking_form_submit($form, &$form_state) {
    //  drupal_set_message("in form submit");
    //  dpm($form_state, 'form_state');
    
        foreach ($form_state['values']['submitted_tree'] as $form_state_key => $form_state_value) {
    
            $form_state['storage'][$form_state_key] = $form_state_value;
        }
    }
    

    Note: added the ' as it was lost

提交回复
热议问题