简体   繁体   中英

how to grab optional values in to the edit form in laravel

I am developing laravel application and submit some form data using form.blade.php file

 <select name="status" id="status">
                    <option value="">Choose a status</option>
                    <option value="Upcoming">Upcoming</option>
                    <option value="Active">Active</option>
                    <option value="Completed">Completed</option>
                </select>
                @if ($errors->has('status'))
                    <span class="help-block">{{ $errors->first('status') }}</span>
                @endif

and now I need edit this data using edit form and this is My edit form and grab values from table,

<select name="assign" id="status">
                    <option value="{!! $task->assign !!}">{!! $task->assign !!}</option>

                </select>
                @if ($errors->has('assign'))
                    <span class="help-block">{{ $errors->first('assign') }}</span>
                @endif

this is working but unable to select other optional values in the edit form optional values input. how can I fix this problem?

John, you should use "multiple" attribute for select:

 <select name="status" id="status" multiple> <!-- Options here --> </select> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM