Question

first i use laravel blade for my input from, like this

{{ Form::open('practicums/'.$practicums->id, 'PUT') }}

<table align="center">
            <tr>
                <td>{{ Form::label('name', 'Practicum Name') }}</td>
                <td width="75px"></td>
                <td>{{ Form::text('name', $practicums->name) }}</td>
            </tr>
</table>

i want to use parsley.js to validate the input, i add

data-validate="parsley"

as

{{ Form::open('practicums/'.$practicums->id, 'PUT', array('data-validate' => 'parsley')) }}

but when i add parsley.js parameters on input form (like: data-type,data-required, ets) it's error. then i use 'old' input form like

<input type="text" id="name" name="name" data-required="true"/>

it works. How to use the parsley.js parameters in Laravel Blade? Can i still use input form from Laravel Blade with parsley.js, or i should use the old method?

Thanks before.

Était-ce utile?

La solution

maybe you should share what's the error it appear ?

i m using the parsley with laravel 4 without any problem, this is my sample code

{{ Form::text('name',Input::old('name'),array('id'=>'name','data-required'=>'true','data-required-message'=>'Name Required','placeholder'=>'Please enter name')) }}

Autres conseils

You should do like this

{{ Form::open('practicums/'.$practicums->id, 'PUT', array('data' => 'parsley-validate')) }}

This might help you.

{!! Form::open(['route' => 'posts.store','data-parsley-validate'=>'']) !!}
        {{Form :: label('title','Title:')}}
        {{Form:: text('title',null,array('class'=>'form-control','required'=>'','max length'=>'255'))}}

        {{Form :: label('slug','Slug:')}}
        {{Form::text('slug',null,["class"=>'form-control','required'=>'','min length'=>'5','max length'=>'255'])}}

        {{Form::label('body','Post Body:')}}
        {{Form::textarea('body',null,array('class'=>'form-control','required'=>''))}}

        {{Form::submit('Create Post',array('class'=>'btn btn-success btn-block','style'=>'margin-top:20px;'))}}

        {!! Form::close() !!}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top