One is for client-side validation, and the other is for server-side validation? Client-side validation is a nicety that makes the validation process less painful for a client. But you can't rely on it for any sort of "security" since all it takes to bypass it is to turn of javascript.
Hence, you must also perform a server-side check.

Cheers,

Robert

On Mar 21, 2008, at 3/218:55 PM , Angelo Chen wrote:

Hi,

Looking at Tapestry.js' addValidator for 'Required':

required : function(field, message)
{
    Tapestry.addValidator(field, true, function(value, event)
    {
        if (value == '')
            event.recordError(message);
    });
},

and also the Required.java, it has a validation too:

public void validate(Field field, Void constraintValue, MessageFormatter
formatter, Object value)
         throws ValidationException
 {
     if (value == null || value.toString().equals("")) throw new
ValidationException(buildMessage(formatter, field));
 }

Why the same condition is being checked in two places, any reason? thanks.

A.C.
--
View this message in context: 
http://www.nabble.com/t5%3A-validator-questions...-tp16213766p16213766.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to