Jquery validation and php form validation at once

I’m a fan of the idea that validation should take place both server side and client side, but what if both execute at the same time? I’m using codeigniter and jquery validation. I’ve been coding almost three months, but the problem shows just now.

Any help will do. thank you.

The usual pattern is for JS to monitor user input and, via Ajax (checking the server-side validation rules), give feedback to the user without requiring a page refresh. Both shouldn’t execute at the same time, as JS should do the checking on the client side when data is being typed, while server-side validation happens after submission.

Having separate JS validation code is kind of inefficient, but still, JS will normally abort submission to the server if it catches an error.

It happens to me occasionally. Is it alright if I’ll just do the server-side validation thing when js is turned off? But, honestly in my entire life I haven’t seen a browser that its JS is turned off (except in ff webdeveloper) . I compromised to it halfheartedly.

Indeed, there always should be a server-side fallback.

I haven’t seen a browser that its JS is turned off

You wouldn’t see it unless you were looking over the shoulders of all your site users. People have the option to turn off JS in their browser. But that’s not the whole issue. They may be using a browser with poor JS support, or a browser plugin might be messing with your script etc. So JS can fail as well as be off. You just can’t rely on it, because you can’t control it.

JS should be thought of as an enhancement rather than a dependancy—at least, as much as possible. So your server side script is essential, but client side validation is a nice enhancement for those who can access it or who want it.

Thank you for enlightening me sir.

So my problem about the server and client side validation
showing at the same time is more on about my browser quirks?
Is there anything I can do about it.

No, not all all. It’s to do with your code setup. :slight_smile: Perhaps explain what you have so far. (I’m not an expert at this, however, so if need be, we can encourage others to join the discussion.)