JQuery Form validation Plugin validating single field - javascript

Hi I am using this form validation Plugin to validate a form
http://bassistance.de/jquery-plugins/jquery-plugin-validation/
I need to check one email field valid and it exists in db or not.
any solutions appreciated !

First use that plugin to validate if email field is correct. After that use for example .ajax()-function from jquery to send validated email to server. I don't know what is your backend, so it is hard to say how exactly you should do the backend part, but basicly you need to do database query which checks if email is in the database or not. After that function can return value to client and so on...

Related

How to send Data into php file using angular and send email using php with mobile 10 digit validation

I have a form there is 4 input Name, Mobile, Email and Message I want to submit form data into php file using angular and also validation on every field with mobile 10 digit. And in php also again validate all form filled also mobile and send it into email
There are lot of way to share data between two lang, but API is most efficient.
Following link might help

Javascript validation for duplicate username

I have created 2 pages in asp.net login and signup.
Now I want to check whether the username entered is already present before inserting data into database on signup page. I want to do this validation using javascript.
I tried doing it using compare validator but it did not worked.
Here are some way to do this.
You send all the username to the javascript when the page load and validate against the username list.
You make an AJAX query to your server to validate the username from the client side.
When the user submit the signup form, you validate the username received against your database and send an error if you find it.
You can use ajax to call a server side method that verify if the username already exist. This can be done very easy with JQuery. Look at the documentation here: http://api.jquery.com/jQuery.ajax/

Ajax validation with jquery form validation plugin

I am using jquery form validation plugin
http://bassistance.de/jquery-plugins/jquery-plugin-validation/
If form is invalid my server gives response in name pair combination where
:
data:
email:"Is invalid"
name" "Is invalid"
is it possible to use with jquery ajax on form submit and mark field as an error using this plugin ?
The jQuery validate plugin is all about client validation. It supports remote validation as well but it is intended to be used to validate a single field but you can send additional fields to the server to validate this single field. If you are performing your entire validation of multiple fields on the server (which you always should), you'd better leave it to the server when the form is submitted.

Validate while user is typing and validate on submit

I validate user input twice actually. While user is typing I check the input to provide some feedback to the user.
When the user submits the form I validate the input again to check whether the input is correct.
I think using both would cause redundancy and I would like to avoid that.
Is it correct to have just the first validation method? What do you think?
One thing you will definitely miss if you only validate while the user is typing is empty fields.
I think the best of both worlds is to add a "valid" class to valid inputs in your as-you-type validation. Then on submit, skip checking the inputs that have this class.
That said, client-side validation is mainly for the user experience. Server-side validation can always pick up on and notify the user of any errors the client-side validation missed. So it is up to you here to decide how much the client-side validation should do based on your form.
I think you should Just validate on onblur() event for each field (Enough for client side).
And also validate on Server side , can't trust user input .

another Bug in jquery validator?

i use remote method of validator for checking if username exists in DB
my scenario:
form with one field (username of course)
i filled field
it passes validation, but i don't sending form yet
going to DB inserting username that i filled in form that i still don't sent yet
returning to my form press on submit btn
voila, it pass validation (here the issue if u don't understand yet)
of course i did validation on the server side too, but it will be great that validation for remote method will fire too when sending form
p.s. i'm using 1.5.5 version but see that this issue still exists
If I'm reading this properly, jQuery is not at fault here.
If this isn't correct let me know. I am imagining a registration form.
I go to your form, enter a username. jQuery says the username is available using the remote validation technique.
Before I click submit, someone else submits the same form with the same username, and gets it.
I can still submit the form, even though I have an already taken username.
This is a classic scenario. A concurrency problem. The data is now stale that was pulled by jQuery validation during my registration. You need to adjust for this scenario in your remote page or make jquery validation run on form submit as well. You could just call validate() on your form in the submit method of your form.

Categories

Resources