php - Laravel 4: Can't get model data with a form macro on edit form -
on edit forms have problem populate form fields data stored in db.
when use code snippet doc everything's fine. need append css class form field, , cannot passed argument for:
{{ form::text('email') }}
so i've created below form::macro
form::macro('textclass', function($name, $class = null) { return '<input type="text" name="'.$name.'" id="'.$name.'" class="'.$class.'"/>'; });
so can use on views:
{{ form::textclass('email', 'm-wrap span12') }}
but field doesn't populated model data.
any idea on how fix this?
for reference if want check form
generates can vendor/laravel/framework/src/illuminate/html/formbuilder
.
in formbuilder
class you'll find methods inputs. method text input looks this
public function text($name, $value = null, $options = array()) { return $this->input('text', $name, $value, $options); }
as can see second parameter value , third options array.
so form
form::text('email', null, array('class'=>'m-wrap span12'))
Comments
Post a Comment