mardi 30 octobre 2018

Validation jQuery rules

I have a form with 2 input name and description I want to validate this two field with jquery but don't accept name how can I put this two name in rules

@foreach($languages as $language)


@endforeach

I do this in jquery but don't work any idea

@if(count($languages))
                   @foreach($languages as $language) {
                      @if($language->default)
                  form.validate({
                    /*errorElement: 'span',*/
                        errorClass: 'help-block',
                    highlight: function (element, errorClass, validClass) {
                        $(element).closest('.form-group').addClass("has-error");
                      },
                    unhighlight: function (element, errorClass, validClass) {
                        $(element).closest('.form-group').removeClass("has-error");
                    },
                        rules: {
                        "name['.$language->id.']": {
                            required: true
                        },
                        "description['.$language->id.']": {
                            required: true
                        }
                    }
                });
                    @endif
                    @endforeach
                    @endif



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire