cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oceatoon <t.katelb...@systheo.com>
Subject Re: Client side validation
Date Thu, 25 Nov 2004 15:48:16 GMT
Luca Garulli wrote:

> On Thu, 25 Nov 2004 13:33:17 +0100, oceatoon <t.katelbach@systheo.com>
> wrote:
>> >> But then don't you have double validation ?
>> >
>> > Yes, server side validation must be always guarantee. Client side
>> > validation is useful basically for two reasons:
>> >
>> > 1. avoid unnecessary server load
>> > 2. some customer doesn't want page refresh. There are other techniques
>> > to avoid page reload, but it's a little bit more complex...
>> Yes, with CJS there wouldn't be long reloads, but many reactive
>> validations and one longer send in the end. I'm curious of what you mean
>> by more complex techniques to avoid reload ?
>> 
>> Thanks, I guess double validation has to be then,
>> will you publish your transformer to CJS ?
> 
> Yes, but I don't know where to post it. Current version of transformer
> generates one function per widget. The transformer gets the "mode"
> parameter:
> = form: checks all fields in one shot, generally in the submit button
> = field: checks each field when the focus is lost, using onBlur()
> event in javascript
ok great, so all potential errors are validated instantly as the user leaves
the widget
> 
> Inside the function:
> 
> - if required='true', checks if the value is not null
> - if datatype=integer|long, checks the number
> - if datatype=double|decimal, checks the number considering also the
> decimals - if datatype=date, then checks the date format in the (optional)
> format specified in fi:convertor/@pattern
> 
> After all single validate functions, the validate_form() function will
> be generated with the call to each functions, aggregating the error
> fields name in the array returned.
correct me if I misunderstood, this is for the case if the user didn't enter
some of the widget? in which case they couldn't be singularely validated,
so you return an array of the remaining errors? sounds good :)
> 
> So you can customize the error management with a function like this:
> 
> function validate()
> {
>   var results = validate_form();
>   var msg = "";
>   for( var i = 0; i < results.length; ++i )
>   {
>     msg += "\nError on filed: " + results[i];
>   }
>   if( results.length > 0 )
>     alert( "Error on validation:" + msg );
> }
> 
> Please, tell me suggestion and improvement to insert at the fly.
No pb , but if you send me your xsl's I can integrate them and help debug or
test drive it, and maybe contribute(t dot katelbach at systheo dot com)

Thanks
Tibor


Mime
View raw message