My front-end validation rules don't seem to work. Herewith my create.blade.php and member_form.blade.php files
create.blade.php
{!! Form::model($member, ['action' => 'MemberController@store', 'id' => 'createform']) !!}
@include('members.partials.member_form')
<button class="btn btn-success" type="submit">Save Member</button>
{!! Form::close() !!}
<script>
$(document).ready(function(){
$("#createform").validate({
rules: {
name: {
required:true
}
}
});
});
</script>
member_form.blade.php
<div class="form-group">
{!! Form::label('name', 'First Name:') !!}
{!! Form::text('name', null, ['class' => 'form-control']) !!}
</div>
When I'm testing the Jquery validation plugin, I only get my back-end validation messages. No front-end validation message appear when I try to create a blank create form where no name input is entered. Did I enter the js script in the wrong place or is my code wrong? Documentation seem to be inline with what I coded here.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire