Support the ongoing development of Laravel.io →
posted 10 years ago
Forms

Hello,

I have this form :

{{ Form::open(array('url' => "abbonementen")) }}	
											<div class="form-group">
													{{ Form::select('soort1', ['Jaarabbonement', 'Knipkaart', 'Half-jaar abbonement', 'Kwartaal abbonement']) }}
												</div>
                                                                                                @if ($soort1 != "knipkaart") 
												   <div class="form-group">
													{{ Form::select('soort2', ['Klein', 'Middel', 'Groot']) }}
												  </div>
                                                                                                 @endif
												<div class="form-group">
													{{ Form::label('bedrag', 'Bedrag') }}
                                                                                                        {{ Form::text('bedrag') }}
												</div>
                                                                                                {{ Form::submit('Save', array('class' => 'btn btn-sucess')) }}
                                                                                                {{ Form::close() }}

What I want to achieve is that if a user chooses knipkaart on the first select box the user will not see the second checkbox. There is no small, middle or big knipkaart.

How can I make this work ?

Roelof

Last updated 2 years ago.
0

Add an id to the second select box then use javascript to hide the second box based on the first choice.

var $text = $( "#selectbox1 option:selected" ).text(); //selected option from first box

if $text = 'knipkaart' $( "#selectbox2).hide(); //hide the box

Last updated 2 years ago.
0

Thanks

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.