我在下面有注册代码。我想从name
之类的链接中预先填充其表单字段position
和mydomain.com/register?ref=abc
。
<form class="form-signin" action="{{ route('register') }}" method="post" name="form">
{{csrf_field()}}
<div class="row">
<div class="col-md-6">
<label for="fullname">Referrer Name</label>
<input class="form-styling" type="text" value="{{old('ref_name')}}" id="ref_name" required placeholder=""/>
<div id="ref">
</div>
@if ($errors->has('referrer_id'))
<span class="help-block">
<strong>{{ $errors->first('referrer_id') }}</strong>
</span>
@endif
</div>
我尝试过:
app('request')->input('ref') in name fied
它会预先填充,但不会对该预先填充的名称进行验证。
验证码:
@if ($errors->has('referrer_id'))
<span class="help-block">
<strong>{{ $errors->first('referrer_id') }}</strong>
</span>
@endif
答案 0 :(得分:0)
标签必须分配给输入的ID,验证必须分配给输入的名称。
<label for="fullname">Referrer Name</label>
<input class="form-styling" type="text" value="{{ old(request()->query('referrer_id')) }}" name="{{ request()->query('referrer_id') }}" id="fullname" required placeholder=""/>
和称呼
@if ($errors->has(request()->query('referrer_id')))
<span class="help-block">
<strong>{{ $errors->first(request()->query('referrer_id')) }}</strong>
</span>
@endif