Support the ongoing development of Laravel.io →
Blade Forms Validation

Hi , I have a form in my blade.php and a text input field in it which takes a space(' ') by default. I have mentioned some validation rules for this particular field in my controller. When user enters some wrong data and submits the form then validation fails then user is redirected to this very same page. If I use blade sytax as shown below the user entered data is retained , but if I use normal HTML syntax for my input field then the user entered data is not retained. Why is this happening so? Is blade intelligent to detect validation faliure and populate old data instead of default one. ?

My blade file snippet :-

<div class="form-group"> {{ Form::label('pkgname', 'Name') }} <label class="text-mandatory">*</label> {{ Form::input('text', 'pkgname', ' ' , array( 'placeholder' => 'Enter your package name', 'class' => 'form-control' )) }} </div>

My controller code:- if ($validation->fails()) { Log::info("INFO CREATE VALIDATION FAILED "); return Redirect::route('planner-packages-addNewPkg')->withErrors($validation)->withInput(); }

Last updated 3 years ago.
0

You got it. Blade is smart. If you want to use raw html, it needs to what to use. Check out the docs here...

http://laravel.com/docs/4.2/requests#old-input

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.