2

I am using the CI validation class to do server-side validation and Jquery validation to do client-side validation. Is there some way I can leverage the CI validation and form building, so that when it is creating the form elements it creates them with class="<equivalent of CI validation rules>"? This way, if I change the valiation rules for an element I only have to do it in the CI rules and it automatically changes for Jquery.

Thanks,

Lemaint

2 Answers 2

1

You could make ajax calls back to CI for validation using $.ajax or $.post, that way you only have to create your validation rules in CI.

Here's an example I found to get you started: jquery post codeigniter validation


Is there a way to map CodeIgniter Validation class to Jquery validation?

Not built-in. Not sure best way to approach this, but you could put all your rules in a validation config file and somehow get your jQuery to parse that file for validation rules when needed.

Sign up to request clarification or add additional context in comments.

Comments

1

There is no out of the box solution that i know of out there to do this. You would have to create one yourself.

It would have to be a config file that maps what the codeigniter validation is called to the jquery equivalent and then that would have to be parsed for each field.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.