Link to home
Start Free TrialLog in
Avatar of Squadless
Squadless

asked on

Struts <field-validator> for email

Hello,

I have attached 2 validators to validate wether the user enters or leaves the email field blank and also a validator to see if is valid or not valid from the default.xml from opensymphony.

How do I add an other validator to tell me that the email already exists?  Note: im already making a DB call and already know that the email exists... Just need the actual 3rd validator.  

Please help!!!

<field name="newCompanyAdminEmail">
        <field-validator type="requiredstring">
            <message>Please enter the admin email.</message>
        </field-validator>
        <field-validator type="email">
            <message>The email address you entered is not valid.</message>
        </field-validator>
    </field>

Open in new window

Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

<<How do I add an other validator to tell me that the email already exists?>>
but why would you want to do it, since first validator is doing exactly the same.

may be i didn't understood the requirement, can you help?
Avatar of Squadless
Squadless

ASKER

sure, the first validator checks to see if the field is blank or not, the second validator checks to see if it has a @ and a . , the third validator will check to see if the email entered by the user already exists in the database.  im making the java call and know if it exists or not, but i need to catch that action using a validator not a javascript popup.
HELP
ASKER CERTIFIED SOLUTION
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial