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

前端 未结 5 502
感情败类
感情败类 2021-02-07 17:39

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:30

    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.

提交回复
热议问题