jQuery form Validation plugin with JSP
|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
jQuery form Validation plugin with JSPI have a static html page for testing and the remote field is wired
correctly with email as the following rules: { FirstNameEdit: { required: true }, LastNameEdit: { required: true }, EmailEdit: { required: true, email: true, remote: "emails.jsp" } , EnrollYear: {required: true} }, messages: { FirstNameEdit: {required:"First name is required"}, LastNameEdit: {required:"Last name is required"}, EmailEdit: {required:"Valid email address is required", remote:"Incorrect email address"}, EnrollYear: {required:"Choose one from the list"} } The emails.jsp page is very simple page as the following <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <html> <head><title>Remote Email Validator</title></head> <body> <% //get an instance of the email validator if (request.getParameter("email") == null) { out.print("false"); } else { String email =request.getParameter("email"); email = email.trim(); if(email.equals("abc@...")){ out.print("false"); } else{ out.print("true"); } } %> </body> </html> I would like to know what did I do wrong such that email is not using the result from emails.jsp when making a remote validation. Thanks, Felix |
|
|
Re: jQuery form Validation plugin with JSPThe value you return should be simply just "true" or "false". No HTML
or other stuff. Not: <html> <head><title>Remote Email Validator</title></head> <body> true </body> </html> or: <html> <head><title>Remote Email Validator</title></head> <body> false </body> </html> Just: true or: false Notice the difference? :) On Nov 2, 1:10 pm, Felix <gre1...@...> wrote: > I have a static html page for testing and the remote field is wired > correctly with email as the following > rules: { > FirstNameEdit: { required: true }, > LastNameEdit: { required: true }, > EmailEdit: { required: true, email: true, remote: > "emails.jsp" } , > EnrollYear: {required: true} > }, > messages: { > FirstNameEdit: {required:"First name is required"}, > LastNameEdit: {required:"Last name is required"}, > EmailEdit: {required:"Valid email address is > required", remote:"Incorrect email address"}, > EnrollYear: {required:"Choose one from the list"} > } > > The emails.jsp page is very simple page as the following > > <%@ page language="java" contentType="text/html; charset=UTF-8" > pageEncoding="UTF-8"%> > > <html> > <head><title>Remote Email Validator</title></head> > <body> > <% //get an instance of the email validator > if (request.getParameter("email") == null) { > out.print("false"); > } else { > String email =request.getParameter("email"); > email = email.trim(); > if(email.equals("a...@...")){ > out.print("false"); > } > else{ > out.print("true"); > } > > } > %> > </body> > </html> > > I would like to know what did I do wrong such that email is not using > the result from emails.jsp when making a remote validation. > > Thanks, > > Felix |
| Free embeddable forum powered by Nabble | Forum Help |