Hello,

I can see two options but there are probably others aswell:

1. emit the id value of the input tag so your javascript will be able to find it.

2. change your CSS to style on the class of the tag vs the id.


For 1, I would :

add a behviour like this to your TextField:

new AbstractBehavior() {

            private Component field = null;

            @Override
            public void renderHead(IHeaderResponse response) {

response.renderJavascript("F={};F.id='"+field.getMarkupId()+"'", "custom-id");
            }


            @Override
            public void bind(Component component) {
                this.field = component;
            }


        };

Then you can have your javascript look at F.id which will contain the markupid for your textfield.

For 2.

CSS:

input.static-style {
    color: red;
}

<input wicket:id="birthday" class="static-style" type="text" />

Regards,

Mike


When I add an AjaxFormComponentUpdatingBehavior to a component (a TextField<String> in particular though I don't think that matters), Wicket assigns an HTML "id" attribute to the component by taking the "wicket:id" value I specified and appending a character.

So, if my original HTML had: <input wicket:id="birthday" id="xxxxx" type="text" /> At runtime I get: <input wicket:id="birthday" id="birthdayX" type="text" />

This messes up some static CSS/Javascript I have in the page, which relies on locating hte component using its original id.

Is there a way to prevent this?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to