Reputation: 641
I want to evaluate forms built by Laravel on clientside with parsley .js.
But when I hit Submit no validation is made.
** in 'view.blade.php**
{{Form::open(array('action' => 'PositionController@createPosition', 'method' => 'post','files'=>true,'enctype' => 'multipart/form-data','parsley-validate' => 'true'))}}
{{Form::text('position',NULL,array('parsley-required' => 'true', 'parsley-type' => 'number'))}}
{{Form::submit('Hinzufügen',array('class' => 'blue'))}}
{{ Form::close() }}
** Output **
<form method="POST" action="http://localhost/positions" accept-charset="UTF-8" enctype="multipart/form-data" parsley-validate="true">
<input name="_token" type="hidden" value="1234">
<input parsley-required="true" parsley-type="number" name="position" type="text">
<input class="blue" type="submit" value="Hinzufügen">
</form>
Laravel Version: 4.1
Parsley Version: 1.2.3
Update
It seems to work, if I replace the form form builder code with a hardcoded HTML-Form. So I looked around the docs and found:
$( '#form' ).parsley();
Bind Parsley to a form (Useful if your form is dynamically rendered.)
But after adding '#parsleyForm' and the JavaScript binding to my site still nothing happens
$( document ).ready(function() {
$('#parsleyForm').parsley();
});
Any suggestions how I can use the Form Builder and Parsley?
Upvotes: 0
Views: 1325
Reputation: 3405
Your code works for me: http://jsfiddle.net/w54Q6/
With no changes, only specifying jquery
and parsley
as resources.
So, as @user3158900 has said, you probably haven't set up your paths to jquery and parsley correctly.
Upvotes: 1