cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yatin Shah <nos...@kripa.com>
Subject Re: Bug in Forms v1, 2 & 3 using Cocoon v2.1.5, flow, javascript validation and debugging
Date Tue, 08 Jun 2004 21:20:35 GMT
I also have a similar problem.
I upgraded to 2.1.5, and now my javascript(flow) based forms(Cocoon 
Forms - woody) validation is no longer supported.
I searched the mail list but could not really find a suitable solution.

My requirement:
Perform business level validation to ensure the entered data are valid 
before notifying the user that
their form request is accepted and refreshing the web page with 
acceptance message.
[business level: requires access to external database for checking valid 
values.]

Pre 2.1.5 solution:
Define a javascript function, a part of the flow script, to do business 
validation processing and
associate this function with the form using:

    val_method = Validate_signin;

    formMgr = new Form(form_definition);
    formMgr.validator = val_method;   <=================== SET 
Validation Method =======
    formMgr.load(model);
    var kont = formMgr.showForm("XMLcollector", { "flowRequest": 
flowRequest, "collector":"cocoonform", collectorData":collectorData, 
"model": model});

    ...
    ...
    function Validate_signin(formMgr, bizdata) {
        //
        //Within function I can access any widgets and my flow variables
        //to validate my form.
        //I can also access the database data for my validation.
    }

 From the mailing list I gather following hints for 2.1.5. Are there any 
other options? Any suggestions/code is welcome.

A. "I used fd:javascript though where only external validation functions 
are called. So I determine how a field has to be validated in the form 
definition, but the validation itself is scripted in external js 
files."  
http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=108639582110249&w=2
Joerg, can you give more details! Is it possible to access flow 
variables from your external js file?
B. "On each widget, you can add validators using the 
Widget.addValidator(...) method. The argument is an implementation of 
WidgetValidator. See the javadoc of that interface for more details on 
what an implementation of a WidgetValidator is supposed to do." 
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=108401608717385&w=2
This seems to be for individual widget level validation support. How can 
this be used for the form level validation? A sample code will be very 
helpful.

TIA.
Yatin

>
> The flow level validation hack was replaced in favor of widget 
> validators: 
> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=108555680116244&w=4
> I used fd:javascript though where only external validation functions 
> are called. So I determine how a field has to be validated in the form 
> definition, but the validation itself is scripted in external js files.
>
> Joerg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message