Laravel: textarea does not refill when using Input::old

前端 未结 5 1405
面向向阳花
面向向阳花 2021-02-07 17:42

I am experiencing that only the Input Textfields respond as expected when I write the code to repopulate a form (when errors were found for example) or when from a table row I c

5条回答
  •  你的背包
    2021-02-07 18:11

    I'd like to add one thing, if you use Form Class for the form and elements then you don't need to explicitly right the Input::old('element-name') to retrieve the value of the previous form submission.
    Just use
    {{ Form::text('name', null, array('id'=>'name', 'class' => 'class-to-apply')) }}
    And you're good to go.

    Here, null value for the text field will be null for the first time, and if you redirect back this page with input then this will automatically grab the value.

提交回复
热议问题