简体   繁体   中英

failing to display the data in the edit form : laravel

when I using model like this :

<div class="form-group col-sm-6">
        {!! Form::label('nop3', 'Nop3:') !!}
        {!! Form::text('nop3', null, ['class' => 'form-control']) !!}
    </div>

data nop3 can be displayed in textfield nop3 : https://postimg.org/image/x4ar40u7b/

but, I using model like this :

<div class="form-group col-sm-6">
    <div class="form-group col-sm-3">
        NOMOR P3
    </div>
    <div class="form-group col-sm-9">
        <input type="text" name="nop3" class="form-control">
    </div>
</div>

data nop3 can not be displayed in textfield nop3 : https://postimg.org/image/jin2ns0y9/

whereas these two models the same

if anyone can explain to me?

Your assumption, that the two approaches you showed in your question are the same, is wrong!

When using the Form helper class, there are a lot things that work behind the scenes.

If you decide not to use the helper classes, you need to populate your form manually!

It can look like this:

<div class="form-group col-sm-6">
    <div class="form-group col-sm-3">
        NOMOR P3
    </div>
    <div class="form-group col-sm-9">
        <input type="text" name="nop3" class="form-control" value="{{$nop3}}">
    </div>
</div>

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