mercredi 25 janvier 2017

laravel 5 radio button

I am currently on internship and I have to make an administrator site. I do it with FrameWork (php) -> Laravel. I have a little problem and I can't solve it ... Or rather I don't know what to do. In a form to create a product type, I need the name of the type and its description. I also need to know what sub-range it is. If it has no sub-range then of the range. I would like to make a radio button to choose between the two and when I select range, it then shows me the list of ranges. And of course if I click on sub-range, it shows me a list of subranges. For now, I display both drop-down lists in my code:

{!! Form::open(array('route' => 'type.store')) !!}
 
        <div class="form-group">
            {!! Form::label('name', 'Name', ['class'=>'tai2']) !!}
            {!! Form::text('name', '', ['placeholder'=> 'Name' , 'class'=>'form-control contr']) !!}
            @if ($errors->has('name'))
            <div class="alert alert-danger">
                @foreach ($errors->get('name') as $messages)
                    
                @endforeach
            </div>
        @endif
        </div>
        <div class="form-group">
            {!! Form::label('description', 'Description', ['class'=>'tai2']) !!}
            {!! Form::textarea('description', '', ['placeholder'=> 'Description' , 'class'=>'form-control contr' , 'style' => 'height:180px;']) !!}
        @if ($errors->has('description'))
             <div class="alert alert-danger">
                @foreach ($errors->get('description') as $messages)
                    
                @endforeach
            </div>
        @endif
        </div>
     
     
<!-- Radio button required to select a range or sub-range and display only one. -->
 
 
    <div style="height:100px;">
         
        <div class="lister">
            {!! Form::label('range', 'range') !!}
            {!! Form::select('range', $ranges, null, array('class'=>'form-control')) !!}
        </div>
 
        <div class="lister2" style="float:right">
            {!! Form::label('sub-range', 'Sub-range') !!}
            {!! Form::select('sub-range', $ranges, null, array('class'=>'form-control')) !!}
        </div>
 
    </div>
     
 
    <button type="submit" class="btn btn-primary center-block">Créer</button>
    {!! Form::close() !!}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire