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

后端 未结 8 1392
春和景丽
春和景丽 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:52

    Drupal will do this by default if you include:

    $formproductname['#redirect'] = FALSE;
    

    In your $formproductname array.

    0 讨论(0)
  • 2020-12-31 21:54

    I usually solve this by putting the submitted value in the $_SESSION variable in the submit hook. Then the next time the form is loaded, I check the $_SESSION variable for the appropriate key, and put the value into the #default_value slot if there's anything present.

    0 讨论(0)
提交回复
热议问题