can anyone tell me how to create a form that it's field appear conditionally. for example i want to create a form form creating users properties.. so if it's a land the form should be able to receive only length and height, if it's a house it should receive in addition the number of rooms, floors...etc all thoughts appreciated.. PS: it would help if it uses laravel collective like my essay here but it's not working
@if($property->category == 'House')
@if ($property->for_sell)
<div>
Form::label('garage', 'With Garage')
Form::radio('garage', 1, null, ['class'=>'radio form-control'])
</div>
<div>
Form::label('images', 'Add Photos')
Form::file('images')
</div>
<div>
Form::label('nbr_of_rooms', 'number of rooms')
Form::number('nbr_of_rooms', null, ['class'=>'form-control'])
</div>
<div>
Form::label('nbr_of_bathrooms', 'number of bathrooms')
Form::number('nbr_of_bathrooms', null, ['class'=>'form-control'])
</div>
<div>
Form::label('nbr_of_livigrooms', 'number of livigrooms')
Form::number('nbr_of_livigrooms', null, ['class'=>'form-control'])
</div>
<div>
Form::label('nbr_of_floors', 'number of floors')
Form::number('nbr_of_floors', null, ['class'=>'form-control'])
</div>
<div>
Form::label('price', 'price')
Form::number('price', null, ['class'=>'form-control'])
</div>
<div>
Form::label('description', 'Description')
Form::textarea('description', null, ['class'=>'form-control'])
</div>";
@else
<div>
Form::label('garage', 'With Garage')
Form::radio('garage', 1, null, ['class'=>'radio form-control'])
</div>
<div>
Form::label('furniture', 'With Furniture')
Form::radio('furniture', 1, null, ['class'=>'radio form-control'])
</div>
<div>
Form::label('images', 'Add Photos')
Form::file('images')
</div>
<div>
Form::label('nbr_of_rooms', 'number of rooms')
Form::number('nbr_of_rooms', null, ['class'=>'form-control'])
</div>
<div>
Form::label('nbr_of_bathrooms', 'number of bathrooms')
Form::number('nbr_of_bathrooms', null, ['class'=>'form-control'])
</div>
<div>
Form::label('nbr_of_livigrooms', 'number of livigrooms')
Form::number('nbr_of_livigrooms', null, ['class'=>'form-control'])
</div>
<div>
Form::label('nbr_of_floors', 'number of floors')
Form::number('nbr_of_floors', null, ['class'=>'form-control'])
</div>
<div>
Form::label('fee', 'fee')
Form::number('fee', null, ['class'=>'form-control'])
</div>
<div>
Form::label('from', 'from: ')
Form::date('from', null, ['class'=>'form-control'])
</div>
<div>
Form::label('to', 'to: ')
Form::date('to', null, ['class'=>'form-control'])
</div>
<div>
Form::label('fee', 'fee')
Form::number('fee', null, ['class'=>'form-control'])
</div>
<div>
Form::label('description', 'Description')
Form::textarea('description', null, ['class'=>'form-control'])
</div>
@endif
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2jMERXT
via IFTTT
Aucun commentaire:
Enregistrer un commentaire