errorPlacement-option - you don't have a table layout.
Jörn
On Sat, Mar 28, 2009 at 5:09 PM, Smruti Pragyan Misra
<smrutii4u@gmail.com> wrote:
> Hi John,
> Thanks for ur reply.presently I am able to call validate()
> method for both the fields.But it's not working with following code.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
> <%@ taglib prefix="html" tagdir="/WEB-INF/tags/html"%>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
> <spring:theme var="css" code="css" />
> <c:if test="${not empty css}">
> <link rel="stylesheet" href="<c:url value="${css}/signup.css"/>"
> type="text/css" />
> </c:if>
> <html:page title="irise.user.inviteuser">
> <script id="demo" type="text/javascript">
> $(document).ready(function() {
> // validate signup form on keyup and submit
> var validator = $("#signupform").validate({
> rules: {
> email: {
> required: true,
> email: true
> }
> },
> messages: {
> email: {
> required: "Please enter a valid email address",
> minlength: "Please enter a valid email address"
> }
> },
> // the errorPlacement has to take the table layout into account
> errorPlacement: function(error, element) {
> error.appendTo( element.parent().next() );
> },
> // specifying a submitHandler prevents the default submit, good for the
> demo
> submitHandler: function() {
> alert("submitted!");
> },
> // set this class to error-labels to indicate valid fields
> success: function(label) {
> // set as text for IE
> label.html(" ").addClass("checked");
> }
> });
>
> });
> </script>
>
> <h2><fmt:message key="register.user.adduser" /></h2>
>
>
> <span class="bold"><label for="role"><fmt:message
> key="irise.user.defaultrole" /></label></span>
> <form:form commandName="signupform"
> action="/user/register/registerUser" method="post" cssClass="default">
> <fieldset>
> <ol>
> <li>
> <input type="text" name="emailId" size="25" />
> <td class="status"></td>
> <form:errors path="emailId" cssClass="errors"/>
> </li>
> </ol>
> </fieldset><br></br>
> <span class="bold"><fmt:message key="register.user.edit"
> /></span>
> <fieldset>
> <ol>
> <li><fmt:message key="register.user.Subject" />:
> <form:input id="subject" path="subject" />
> <form:errors path="subject" cssClass="errors"/>
> </li>
> </ol>
> </fieldset>
> <table align="right">
> <tr>
> <td><input name="Register" type="submit" value="submit"
> /></td>
> </tr>
> </table>
>
> </form:form>
> </html:page>
> Note: validate.js and jquery.js are included in header.tag.
>
> When I am clicking on submit button , JQuery Validation is not
> happening.Can you please tell me what may the problem?
>
> Thanks,
> Lucky
>
> On Fri, Mar 27, 2009 at 4:33 AM, Jörn Zaefferer
> <joern.zaefferer@googlemail.com> wrote:
>>
>> Same as for any other backend, eg. pick a validation plugin ala
>> http://docs.jquery.com/Plugins/Validation and follow the examples.
>> Come back with any specific questions.
>>
>> Jörn
>>
>> On Thu, Mar 26, 2009 at 8:01 PM, Lucky <smrutii4u@gmail.com> wrote:
>> >
>> > Hi,
>> > I am new to JQuery , can anyone tell me any example ,how to do
>> > form validation for JSP. I have two text box one for Subject and
>> > another one for email Id .
>> >
>> > Thanks,
>> > Lucky
>> >
>
>
>
> --
> Thanks N Regards,
>
> Smruti Pragyan Mishra
>
No comments:
Post a Comment