Change input, based on select:option

Posted 2 months ago by splendidkeen

I have a Verification.php Model, with a verification_table:id, name, city, country

I want to put the select option below, before a signup form. After the user selected a verification, we need to parse the values of $verification into the signup form.

        <option value="0">Select your information</option>
                @foreach(App\Models\Verification::all() as $verification)
                    <option value="{{$verification->id}}">{{$verification->city}}</option> 

How can one build a bridge from the select option to the form input?

@if(select != 0)

put $verification->city into the input #ver-city


let user type its information



<input type="text" name="city" value="{{ Request::old('city') ?: ''}}" id="ver-city" placeholder="{{__('auth.partner-fn-placeholder')}}">

@if ($errors->has('city'))
<span>{{ $errors->first('city') }}</span>

The process should help pre-validate upcoming users. Any ideas how to provide the bridge?

Kindest Regards

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.