You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Matt Raible (JIRA)" <ta...@jakarta.apache.org> on 2006/06/02 00:44:29 UTC

[jira] Created: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes
--------------------------------------------------------------------------------------------

         Key: TAPESTRY-975
         URL: http://issues.apache.org/jira/browse/TAPESTRY-975
     Project: Tapestry
        Type: Bug

  Components: Framework  
    Versions: 4.0.2    
    Reporter: Matt Raible


I have the following in my custom ValidationDelegate:

    public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle,
                                IFormComponent component, IValidator validator) {
        if (isInError()) {
            String cssClass = ((component.getBinding("class") != null) ?
                                component.getBinding("class").getObject().toString() : "");
            writer.attribute("class", cssClass + " error");
        }
    }

However, rather than just writing a single "class" attribute, it writes two:

class="text large error" class="text large" 

Ideally, only one "class" attribute gets written.  Maybe IMarkupWriter nees an appendAttribute() method, or it just needs to be smart enough to detect duplicates?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Posted by "Andreas Andreou (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-975?page=all ]

Andreas Andreou updated TAPESTRY-975:
-------------------------------------

    Issue Type: New Feature  (was: Bug)

> Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes
> --------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-975
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-975
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Framework
>    Affects Versions: 4.0.2
>            Reporter: Matt Raible
>             Fix For: unspecified
>
>
> I have the following in my custom ValidationDelegate:
>     public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle,
>                                 IFormComponent component, IValidator validator) {
>         if (isInError()) {
>             String cssClass = ((component.getBinding("class") != null) ?
>                                 component.getBinding("class").getObject().toString() : "");
>             writer.attribute("class", cssClass + " error");
>         }
>     }
> However, rather than just writing a single "class" attribute, it writes two:
> class="text large error" class="text large" 
> Ideally, only one "class" attribute gets written.  Maybe IMarkupWriter nees an appendAttribute() method, or it just needs to be smart enough to detect duplicates?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Posted by "Matt Raible (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-975?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Raible updated TAPESTRY-975:
---------------------------------

    Attachment: ValidationDelegate.java

It seems that having a "class" attribute causes writer.attribute and writer.appendAttribute to not work. Here's my Tapestry code:

    <li>
        <label class="desc" jwcid="@FieldLabel" field="component:usernameField">Username</label>
        <input jwcid="usernameField" type="text" id="username" class="text large"/>
    </li>

This produces the following when there's an error (notice no new classes in the "class" attribute):

    <li>
        <label for="username" class="desc">Username<span class="req"> *</span></label>
        <span class="fieldError"><img src="/images/iconWarning.gif" class="validationWarning" alt="Warning"></img>&nbsp;You must enter a value for Username.</span><input type="text" name="username" value="" id="username" class="text large" />
    </li>

The extra HTML is because I've overridden the "writePrefix" method.

If I remove the "class" attributes of <label> and <input>, it seems to work properly:

    <li>
        <label jwcid="@FieldLabel" field="component:usernameField">Username</label>
        <input jwcid="usernameField" type="text" id="username"/>
    </li>

Produces the following when there's an error:

<li>
    <label for="username" class="error">Username<span class="req"> *</span></label>
    <span class="fieldError"><img src="/images/iconWarning.gif" class="validationWarning" alt="Warning"></img>&nbsp;You must enter a value for Username.</span><input type="text" name="username" value="" id="username" class="fieldMissing" />
</li>

I've attached my ValidationDelegate.java class.

> Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes
> --------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-975
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-975
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Framework
>    Affects Versions: 4.0.2
>            Reporter: Matt Raible
>            Assignee: Jesse Kuhnert
>             Fix For: 4.1.1
>
>         Attachments: ValidationDelegate.java
>
>
> I have the following in my custom ValidationDelegate:
>     public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle,
>                                 IFormComponent component, IValidator validator) {
>         if (isInError()) {
>             String cssClass = ((component.getBinding("class") != null) ?
>                                 component.getBinding("class").getObject().toString() : "");
>             writer.attribute("class", cssClass + " error");
>         }
>     }
> However, rather than just writing a single "class" attribute, it writes two:
> class="text large error" class="text large" 
> Ideally, only one "class" attribute gets written.  Maybe IMarkupWriter nees an appendAttribute() method, or it just needs to be smart enough to detect duplicates?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Resolved: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Posted by "Andreas Andreou (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-975?page=all ]

Andreas Andreou resolved TAPESTRY-975.
--------------------------------------

    Fix Version/s: unspecified
       Resolution: Duplicate

> Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes
> --------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-975
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-975
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.0.2
>            Reporter: Matt Raible
>             Fix For: unspecified
>
>
> I have the following in my custom ValidationDelegate:
>     public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle,
>                                 IFormComponent component, IValidator validator) {
>         if (isInError()) {
>             String cssClass = ((component.getBinding("class") != null) ?
>                                 component.getBinding("class").getObject().toString() : "");
>             writer.attribute("class", cssClass + " error");
>         }
>     }
> However, rather than just writing a single "class" attribute, it writes two:
> class="text large error" class="text large" 
> Ideally, only one "class" attribute gets written.  Maybe IMarkupWriter nees an appendAttribute() method, or it just needs to be smart enough to detect duplicates?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Posted by "Andreas Andreou (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-975?page=comments#action_12457175 ] 
            
Andreas Andreou commented on TAPESTRY-975:
------------------------------------------

Nope, this is not a coding problem. 
Updating the binding isn't a solution cause:
- users supplying the class parameter do NOT expect the value they pass to change
- class parameter is actually an informal parameter - no way to alter its binding - that i know of :) 

A small cache that would hold attributes of the currently opened tag and would write them out
all at once when the begin-tag closes (instead of writing the attributes on-demand) would help...
but of course this might decrease performance. That's probably why noone has tackled this.



> Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes
> --------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-975
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-975
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Framework
>    Affects Versions: 4.0.2
>            Reporter: Matt Raible
>         Assigned To: Jesse Kuhnert
>             Fix For: 4.1.1
>
>
> I have the following in my custom ValidationDelegate:
>     public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle,
>                                 IFormComponent component, IValidator validator) {
>         if (isInError()) {
>             String cssClass = ((component.getBinding("class") != null) ?
>                                 component.getBinding("class").getObject().toString() : "");
>             writer.attribute("class", cssClass + " error");
>         }
>     }
> However, rather than just writing a single "class" attribute, it writes two:
> class="text large error" class="text large" 
> Ideally, only one "class" attribute gets written.  Maybe IMarkupWriter nees an appendAttribute() method, or it just needs to be smart enough to detect duplicates?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Posted by "Greg Woolsey (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-975?page=comments#action_12457156 ] 
            
Greg Woolsey commented on TAPESTRY-975:
---------------------------------------

The example looks incorrect to me, assuming implicit attributes are written out for this component, then the code should only update the binding, not explicitly write out an attribute that will be written out elsewhere as part of the implicit parameters.

I think this is a coding problem, not a bug with Tapestry.

> Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes
> --------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-975
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-975
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Framework
>    Affects Versions: 4.0.2
>            Reporter: Matt Raible
>         Assigned To: Jesse Kuhnert
>             Fix For: 4.1.1
>
>
> I have the following in my custom ValidationDelegate:
>     public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle,
>                                 IFormComponent component, IValidator validator) {
>         if (isInError()) {
>             String cssClass = ((component.getBinding("class") != null) ?
>                                 component.getBinding("class").getObject().toString() : "");
>             writer.attribute("class", cssClass + " error");
>         }
>     }
> However, rather than just writing a single "class" attribute, it writes two:
> class="text large error" class="text large" 
> Ideally, only one "class" attribute gets written.  Maybe IMarkupWriter nees an appendAttribute() method, or it just needs to be smart enough to detect duplicates?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Posted by "Matt Raible (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-975?page=comments#action_12414313 ] 

Matt Raible commented on TAPESTRY-975:
--------------------------------------

This should probably be marked as a Minor issue, but it doesn't appear like I have rights to do that.

> Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes
> --------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-975
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-975
>      Project: Tapestry
>         Type: Bug

>   Components: Framework
>     Versions: 4.0.2
>     Reporter: Matt Raible

>
> I have the following in my custom ValidationDelegate:
>     public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle,
>                                 IFormComponent component, IValidator validator) {
>         if (isInError()) {
>             String cssClass = ((component.getBinding("class") != null) ?
>                                 component.getBinding("class").getObject().toString() : "");
>             writer.attribute("class", cssClass + " error");
>         }
>     }
> However, rather than just writing a single "class" attribute, it writes two:
> class="text large error" class="text large" 
> Ideally, only one "class" attribute gets written.  Maybe IMarkupWriter nees an appendAttribute() method, or it just needs to be smart enough to detect duplicates?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Reopened: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Posted by "Andreas Andreou (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-975?page=all ]

Andreas Andreou reopened TAPESTRY-975:
--------------------------------------

             
This is not really a dup of TAPESTRY-550, so reopenning...

> Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes
> --------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-975
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-975
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.0.2
>            Reporter: Matt Raible
>             Fix For: unspecified
>
>
> I have the following in my custom ValidationDelegate:
>     public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle,
>                                 IFormComponent component, IValidator validator) {
>         if (isInError()) {
>             String cssClass = ((component.getBinding("class") != null) ?
>                                 component.getBinding("class").getObject().toString() : "");
>             writer.attribute("class", cssClass + " error");
>         }
>     }
> However, rather than just writing a single "class" attribute, it writes two:
> class="text large error" class="text large" 
> Ideally, only one "class" attribute gets written.  Maybe IMarkupWriter nees an appendAttribute() method, or it just needs to be smart enough to detect duplicates?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-975?page=all ]

Jesse Kuhnert updated TAPESTRY-975:
-----------------------------------

    Fix Version/s: 4.1.1
                       (was: unspecified)

> Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes
> --------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-975
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-975
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Framework
>    Affects Versions: 4.0.2
>            Reporter: Matt Raible
>         Assigned To: Jesse Kuhnert
>             Fix For: 4.1.1
>
>
> I have the following in my custom ValidationDelegate:
>     public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle,
>                                 IFormComponent component, IValidator validator) {
>         if (isInError()) {
>             String cssClass = ((component.getBinding("class") != null) ?
>                                 component.getBinding("class").getObject().toString() : "");
>             writer.attribute("class", cssClass + " error");
>         }
>     }
> However, rather than just writing a single "class" attribute, it writes two:
> class="text large error" class="text large" 
> Ideally, only one "class" attribute gets written.  Maybe IMarkupWriter nees an appendAttribute() method, or it just needs to be smart enough to detect duplicates?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: [jira] Resolved: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Posted by andyhot <an...@di.uoa.gr>.
Jesse Kuhnert (JIRA) wrote:
>      [ http://issues.apache.org/jira/browse/TAPESTRY-975?page=all ]
>
> Jesse Kuhnert resolved TAPESTRY-975.
> ------------------------------------
>
>     Resolution: Fixed
>
> I agree with the original issue reported. 
>
> calling attribute() now overrides any previous attributes with the same name.
>
> There are also all manner of new methods available like appendAttribute/get/has/clear/remove /etc.. 
>   

That's a nice one!



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Resolved: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-975?page=all ]

Jesse Kuhnert resolved TAPESTRY-975.
------------------------------------

    Resolution: Fixed

I agree with the original issue reported. 

calling attribute() now overrides any previous attributes with the same name.

There are also all manner of new methods available like appendAttribute/get/has/clear/remove /etc.. 

> Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes
> --------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-975
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-975
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Framework
>    Affects Versions: 4.0.2
>            Reporter: Matt Raible
>         Assigned To: Jesse Kuhnert
>             Fix For: 4.1.1
>
>
> I have the following in my custom ValidationDelegate:
>     public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle,
>                                 IFormComponent component, IValidator validator) {
>         if (isInError()) {
>             String cssClass = ((component.getBinding("class") != null) ?
>                                 component.getBinding("class").getObject().toString() : "");
>             writer.attribute("class", cssClass + " error");
>         }
>     }
> However, rather than just writing a single "class" attribute, it writes two:
> class="text large error" class="text large" 
> Ideally, only one "class" attribute gets written.  Maybe IMarkupWriter nees an appendAttribute() method, or it just needs to be smart enough to detect duplicates?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Resolved: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Posted by "Jesse Kuhnert (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-975?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse Kuhnert resolved TAPESTRY-975.
------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 4.1.1)
                   4.1.4

FieldLabel was calling renderInformalParameters ~after~ letting the validation delegate run.  By default AbstractComponent calls IMarkupWriter.attribute(name, value) when writing informal parameters - thus blowing away any conflicting attributes written by IValidationDelegate.   Moved the call to happen before IValidationDelegate runs. 

> Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes
> --------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-975
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-975
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Framework
>    Affects Versions: 4.0.2
>            Reporter: Matt Raible
>            Assignee: Jesse Kuhnert
>             Fix For: 4.1.4
>
>         Attachments: ValidationDelegate.java
>
>
> I have the following in my custom ValidationDelegate:
>     public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle,
>                                 IFormComponent component, IValidator validator) {
>         if (isInError()) {
>             String cssClass = ((component.getBinding("class") != null) ?
>                                 component.getBinding("class").getObject().toString() : "");
>             writer.attribute("class", cssClass + " error");
>         }
>     }
> However, rather than just writing a single "class" attribute, it writes two:
> class="text large error" class="text large" 
> Ideally, only one "class" attribute gets written.  Maybe IMarkupWriter nees an appendAttribute() method, or it just needs to be smart enough to detect duplicates?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Reopened: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Posted by "Matt Raible (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-975?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Raible reopened TAPESTRY-975:
----------------------------------


In 4.1.3, when I have a label:

<label class="desc" jwcid="@FieldLabel" field="component:usernameField">Username</label>

The following doesn't work to produce <label class="desc error">

@Override
    public void writeLabelAttributes(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component) {
        if (isInError()) {
            writer.appendAttribute("class", "error");
        }
    }

Nor does writer.attribute:

@Override
    public void writeLabelAttributes(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component) {
        if (isInError()) {
            writer.attribute("class", "error");
        }
    }

> Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes
> --------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-975
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-975
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Framework
>    Affects Versions: 4.0.2
>            Reporter: Matt Raible
>            Assignee: Jesse Kuhnert
>             Fix For: 4.1.1
>
>
> I have the following in my custom ValidationDelegate:
>     public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle,
>                                 IFormComponent component, IValidator validator) {
>         if (isInError()) {
>             String cssClass = ((component.getBinding("class") != null) ?
>                                 component.getBinding("class").getObject().toString() : "");
>             writer.attribute("class", cssClass + " error");
>         }
>     }
> However, rather than just writing a single "class" attribute, it writes two:
> class="text large error" class="text large" 
> Ideally, only one "class" attribute gets written.  Maybe IMarkupWriter nees an appendAttribute() method, or it just needs to be smart enough to detect duplicates?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: [jira] Assigned: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Posted by Jesse Kuhnert <jk...@gmail.com>.
Yeah.. Aggregation makes much more sense in this case I think.

I'm sure that's easier than said once getting into MarkupWriterImpl
though...

On 8/15/06, andyhot@di.uoa.gr <an...@di.uoa.gr> wrote:
>
> From "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>:
>
> >      [ http://issues.apache.org/jira/browse/TAPESTRY-975?page=all ]
> >
> > Jesse Kuhnert reassigned TAPESTRY-975:
> > --------------------------------------
> >
> >     Assignee: Jesse Kuhnert
>
> You plans on this?
> Do you have in mind anything similar to what i describe in
> http://issues.apache.org/jira/browse/TAPESTRY-550 ?
>
> >
> > > Overriding ValidationDelegate and adding a "class" attribute results
> in
> > duplicate attributes
> > >
> >
>
> --------------------------------------------------------------------------------------------
> > >
> > >                 Key: TAPESTRY-975
> > >                 URL: http://issues.apache.org/jira/browse/TAPESTRY-975
> > >             Project: Tapestry
> > >          Issue Type: New Feature
> > >          Components: Framework
> > >    Affects Versions: 4.0.2
> > >            Reporter: Matt Raible
> > >         Assigned To: Jesse Kuhnert
> > >             Fix For: unspecified
> > >
> > >
> > > I have the following in my custom ValidationDelegate:
> > >     public void writeAttributes(IMarkupWriter writer, IRequestCycle
> cycle,
> > >                                 IFormComponent component, IValidator
> > validator) {
> > >         if (isInError()) {
> > >             String cssClass = ((component.getBinding("class") != null)
> ?
> > >
> > component.getBinding("class").getObject().toString() : "");
> > >             writer.attribute("class", cssClass + " error");
> > >         }
> > >     }
> > > However, rather than just writing a single "class" attribute, it
> writes
> > two:
> > > class="text large error" class="text large"
> > > Ideally, only one "class" attribute gets written.  Maybe IMarkupWriter
> nees
> > an appendAttribute() method, or it just needs to be smart enough to
> detect
> > duplicates?
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > If you think it was sent incorrectly contact one of the administrators:
> > http://issues.apache.org/jira/secure/Administrators.jspa
> > -
> > For more information on JIRA, see:
> http://www.atlassian.com/software/jira
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: dev-help@tapestry.apache.org
> >
> >
>
>
> --
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo/(and a dash of TestNG), team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

Re: [jira] Assigned: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Posted by an...@di.uoa.gr.
>From "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>:

>      [ http://issues.apache.org/jira/browse/TAPESTRY-975?page=all ]
> 
> Jesse Kuhnert reassigned TAPESTRY-975:
> --------------------------------------
> 
>     Assignee: Jesse Kuhnert

You plans on this? 
Do you have in mind anything similar to what i describe in
http://issues.apache.org/jira/browse/TAPESTRY-550 ?

> 
> > Overriding ValidationDelegate and adding a "class" attribute results in
> duplicate attributes
> >
>
--------------------------------------------------------------------------------------------
> >
> >                 Key: TAPESTRY-975
> >                 URL: http://issues.apache.org/jira/browse/TAPESTRY-975
> >             Project: Tapestry
> >          Issue Type: New Feature
> >          Components: Framework
> >    Affects Versions: 4.0.2
> >            Reporter: Matt Raible
> >         Assigned To: Jesse Kuhnert
> >             Fix For: unspecified
> >
> >
> > I have the following in my custom ValidationDelegate:
> >     public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle,
> >                                 IFormComponent component, IValidator
> validator) {
> >         if (isInError()) {
> >             String cssClass = ((component.getBinding("class") != null) ?
> >                                
> component.getBinding("class").getObject().toString() : "");
> >             writer.attribute("class", cssClass + " error");
> >         }
> >     }
> > However, rather than just writing a single "class" attribute, it writes
> two:
> > class="text large error" class="text large" 
> > Ideally, only one "class" attribute gets written.  Maybe IMarkupWriter nees
> an appendAttribute() method, or it just needs to be smart enough to detect
> duplicates?
> 
> -- 
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
> http://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see: http://www.atlassian.com/software/jira
> 
>         
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
> 
> 


-- 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Assigned: (TAPESTRY-975) Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes

Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-975?page=all ]

Jesse Kuhnert reassigned TAPESTRY-975:
--------------------------------------

    Assignee: Jesse Kuhnert

> Overriding ValidationDelegate and adding a "class" attribute results in duplicate attributes
> --------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-975
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-975
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Framework
>    Affects Versions: 4.0.2
>            Reporter: Matt Raible
>         Assigned To: Jesse Kuhnert
>             Fix For: unspecified
>
>
> I have the following in my custom ValidationDelegate:
>     public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle,
>                                 IFormComponent component, IValidator validator) {
>         if (isInError()) {
>             String cssClass = ((component.getBinding("class") != null) ?
>                                 component.getBinding("class").getObject().toString() : "");
>             writer.attribute("class", cssClass + " error");
>         }
>     }
> However, rather than just writing a single "class" attribute, it writes two:
> class="text large error" class="text large" 
> Ideally, only one "class" attribute gets written.  Maybe IMarkupWriter nees an appendAttribute() method, or it just needs to be smart enough to detect duplicates?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org