cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Lutz <>
Subject 2 small patches...
Date Tue, 13 Sep 2005 10:55:51 GMT
Hi list !

I have two small contributions/patches for the cforms, which maybe could 
be included in the next release... Sorry for posting this to the dev 
list, but I am not sure wether the patches are useful/correct, and 
looking at bugzilla I get the feeling that patches are rather not 
integrated without some attention from the dev list :-)

a) Two issues regarding (diff follows below) (I use 
javaflow with cforms)
a1) additional constructor that allows FormInstance to accept a locale 
(without this constructor there's no chance to pass the user agents 
locale to a javaflow FormInstance). This works for me, although I am not 
sure wether it is the right solution (see
a2) an improvement of validation handling when a submit widget should 
submit without validation

b) Added id to output of validation-message and validation-error in 
forms-field-styling.xsl, so that the javascript alerts can be tested 
with unit tests (new template-match snip follows below). The id of the 
link is val_error_ + widget id. Not sure if the naming is ok for you, 
just tell if you want something different.

Tell me what's welcome, then I'll submit to bugzilla...


<      * Create a form, given the URI of its definition file, the
<      * binding file and set the forms locale
<      */
<     public FormInstance(String definitionFile, String bindingFile, 
Locale locale) {
<         this(definitionFile);
<         this.locale = locale;
<         createBinding(bindingFile);
<     }
<    /**
<      * Create a form, given the URI of its definition file, and
<      * set the locale.
<      */
<     public FormInstance(String definitionFile, Locale locale) {
<         this(definitionFile);
<         this.locale = locale;
<     }
<     /**
<             finished = this.isValid;
 >                 finished = this.isValid;

<xsl:template match="fi:validation-message | fi:validation-error">
        <xsl:element name="a">
            <xsl:attribute name="id">val_error_<xsl:value-of 
select="../@id" /></xsl:attribute>
            <xsl:attribute name="href">#</xsl:attribute>
            <xsl:attribute name="onclick">alert('<xsl:value-of 
select="normalize-space(.)" />');return false;</xsl:attribute>

        <!-- instead of: -->
        <!--a id="val_error_" href="#" class="forms-validation-message" 
onclick='alert("{normalize-space(.)}");return false;'>&#160;!&#160;</a-->

View raw message