Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

adoptavia's avatar

Pre-populate registration field with value

Hi I am using this to return the registration view

return view('vendor.spark.auth.register',['name' => $userSocial->getName(), 'email' => $userSocial->getEmail()]);

I tried adding value="{{name"}} to the form input on the registration form, but it doesnt prepopulate the firm field with the name value

Any suggestions?

0 likes
8 replies
adoptavia's avatar

@REALRANDYALLEN - Hi! I tried that but its not populating the value I dumped the array and the value is there but its not appearing on the spark registration page

adoptavia's avatar

@REALRANDYALLEN - On the Login controller $userSocial is the array, name and email are the values i am pulling from the array and passing to the view

This is the register-common-form.blade.php line <input type="text" class="form-control" name="name" value="{{ $name }}" v-model="registerForm.name" :class="{'is-invalid': registerForm.errors.has('name')}" autofocus>

realrandyallen's avatar

@ADOPTAVIA - It looks like you're mixing Vue directly into a php file, which won't work

But if this is in a Vue component than the issue is you have a v-model and a value property which won't work. You'll need to pass in the name and email as a prop or grab them via an axios call and then set this.registerForm.name and this.registerForm.email to those values.

adoptavia's avatar

@REALRANDYALLEN - My head just exploded :) (not great at vue - sorry!) I do get the general gist and was just looking at props to pass the values and hunting to find where to put it in spark, how would the axios call work in Laravel Spark world? (I do like spark but gosh i wish vue wasnt in it!)

Please or to participate in this conversation.