jeudi 20 août 2015

Return Value to Dropdown Box After Validation Laravel 4

I have 3 dropdown boxes which are depends to the top one in a form. If I have selected all 3 dropdown boxes, but missed out some required fields, how to make the 3 dropdown boxes keep selected with the values instead of blank?

Can I return validation with old inputs also the result from retrieved from query builder? Not sure what it called :D

$a= table1::join('table2','table2.id','=','table1.id')->select('2','table2.id','table1.id as pid')->where('table1.id',Input::get('prj'))->lists('bl', 'id');

$rules = array(...);

$validator = Validator::make(Input::all(), $rules);

    if ($validator->fails()) {
        $messages = $validator->messages();

        return Redirect::back()
            ->withErrors($validator)
            ->withInput(Input::all()); 

    }

Feel free to ask me questions! :D

laravel php laravel 5 laravel 4 laravel with laravel tutorial

Aucun commentaire:

Enregistrer un commentaire