struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rauf Khan" <>
Subject problem w.r.t javascript
Date Tue, 01 Aug 2006 06:15:13 GMT

   Iam trying to validate a simple form which has a name, password & email
field. I have validated that name field(html:text) should contain only
characters, password field(html:text) contains only numbers & email
field(html:text) should contain proper email id.

  When i enter only numbers in name field, only characters in password field
& an invalid email id then only alert msg "please enter only characters" is
coming for name field & msg "pls enter only numbers for password field' *BUT
* no msg is coming for email field even though i have entered a wrong email
id. Also those two msgs are coming simultaneously but i want like this, i
mean to say when i click on submit button first only msg for name field
should show. Then again if i click submit button then msg for password field
should show & so on.

  Also suppose if i enter the proper name (only characs) , proper password
(only numbers) & if i enter the invalid email id then it will show the msg"
please enter a valid email address".

 Iam sending the following code for reference :

<!-- compose form Validation-->
 <form name="InfoForm">
    <field  property="fname"
  <arg key="ComposeForm.fname"  position="0"/>
  <msg name="mask" key="ComposeForm.OnlyChars"/>
  <msg name="minlength" key="ComposeForm.fname.minlength"/>
  <arg name="minlength" key="${var:minlength}"  resource="false"
  <msg name="maxlength" key="ComposeForm.fname.maxlength"/>
  <arg name="maxlength" key="${var:maxlength}" resource="false"
     <field  property="password" depends="required,mask">
           <arg key="ComposeForm.password"  position="0"/>
         <msg name="mask" key="ComposeForm.OnlyNumbers"/>
      <field  property="email" depends="required,email">
          <arg key=""  position="0"/>
          <msg name="email" key="ComposeForm.InvalidEmail"  position="0"/>
#- validations for compose.jsp --
ComposeForm.fname = Please enter the Name.
ComposeForm.password = Please enter the Password. = Please enter the Email.
ComposeForm.OnlyNumbers = Please enter only numbers
ComposeForm.OnlyChars = Please enter only characters
ComposeForm.InvalidEmail = Please enter a valid Email address.
ComposeForm.OnlyNumbersChars = Please enter only numbers & characters
ComposeForm.fname.minlength = First Name cannot be less than  {1}
ComposeForm.fname.maxlength  = First Name cannot be greater than  {2}

Thanks in advance.

Rauf Khan

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message