php - laravel withinput not working for array -
view
<td> {{form::label('start_date', 'start date', array('class' => 'awesome'));}} <input type="date" name ="start_date" class="input-block-level" placeholder="start date" /> </td> <td> {{form::label('end_date', 'end date', array('class' => 'awesome'));}} <input type="date" name ="end_date" class="input-block-level" placeholder="end date" /> </td> </tr> <tr> <td> {{ form::text('answer[]', null, array('class'=>'input-block-level', 'placeholder'=>'option')) }} {{ form::text('answer[]', null, array('class'=>'input-block-level', 'placeholder'=>'option')) }} {{ form::text('answer[]', null, array('class'=>'input-block-level', 'placeholder'=>'option')) }} {{ form::text('answer[]', null, array('class'=>'input-block-level', 'placeholder'=>'option')) }} </td> </tr>
here have validations , if error need redirect same page preloaded data..
if ($validator->fails()) { homecoming redirect::back()->witherrors($validator)->withinput(); }
answer[] beingness array bottleneck here.. withinput not working array ..it shows next error
errorexception htmlentities() expects parameter 1 string, array given (view: c:\xampp\htdocs\sms\app\views\questions\create.blade.php)
any ideas??
i'm having similar problem. apparently, according this post, solution manually add together indexes each of inputs.
so try:
for($i=0; $i<4; $i++){ {{ form::text("answer[$i]", null, array('class'=>'input-block-level', 'placeholder'=>'option')) }} }
instead of using 'answer[]' input name.
php validation laravel blade
No comments:
Post a Comment