You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (Jira)" <ji...@apache.org> on 2019/08/20 15:16:00 UTC

[jira] [Commented] (WICKET-6694) Let's manage the javascript of AutoLabelMarker when there is a error on formComponent

    [ https://issues.apache.org/jira/browse/WICKET-6694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16911448#comment-16911448 ] 

Martin Grigorov commented on WICKET-6694:
-----------------------------------------

You have marked this issue as Trivial but it is far from trivial.

`wicket:for` attribute creates an auto-component, i.e. a Component is being added to the component tree without calling `MarkupContainer#add(...)` and without `wicket:id` in the markup. The application code has no access to this auto-component at all! So even if the method that appends `Wicket.DOM.toggleClass()` is made protected/overridable (this is not possible in 8.x due to binary API break) your application code still won't be able to override it because it doesn't instantiate it in first place.

 

You need to use a proper/non-auto component, e.g. WebMarkupContainer, on the `<div>` which class you need to manipulate. 

`wicket:for` is handy for _most_ of the cases, but not in yours.

> Let's manage the javascript of AutoLabelMarker when there is a error on formComponent
> -------------------------------------------------------------------------------------
>
>                 Key: WICKET-6694
>                 URL: https://issues.apache.org/jira/browse/WICKET-6694
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-core
>    Affects Versions: 8.5.0
>         Environment: Windows 10, java 8
>            Reporter: Duto
>            Priority: Trivial
>         Attachments: error_field.png
>
>
> Hello,
> It will be very nice, if we could modify the javascript '_Wicket.DOM.toggleClass('%s', '%s', %s);_' of AutoLabelMarker when there is an error on composant.
> I use fomantic UI for css library and when a field has an error I need to set the error class not to the label but to a closest of label/component :
>  
> like this :
> {{<div class="field *errror*">}}
> {{   <label wicket:for="name">name</name>}}
> {{<input wicket:id="name" type="text"/>}}{{</div>}}
> Best regards
> Duto
>  



--
This message was sent by Atlassian Jira
(v8.3.2#803003)