You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by tomek <ts...@hotmail.com> on 2012/08/30 10:49:30 UTC

placeholder fallback component

Hi,

Am trying to create fallback component for html5 placeholder, I got it kind
of working with following:

Form<> form = new Form();
form.add(new FallbackPlaceholder());

public class FallbackPlaceholder extends Behavior
{

    public void onComponentTag(Component component, ComponentTag tag)
    {
      String onsubmit = tag.getAttribute("onsubmit");
      String placeholderClear = "placeholder.clearAll();";
      tag.put("onsubmit", onsubmit);
    }
    public void renderHead(Component component, IHeaderResponse response)
    {
      response.renderOnLoadJavaScript("placeholder.init()");
    }
}

this seems to work, but I also need to add something like that:

form.add(new AjaxSubmitLink() {
...
            protected void onError(AjaxRequestTarget target, Form<?> form)
            {
                target.appendJavaScript("placeholder.init();");
            }
});

which is additional step outside FallbackPlaceholder which makes it rather
poor component.

Any idea how can I fix this?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/placeholder-fallback-component-tp4651638.html
Sent from the Users forum mailing list archive at Nabble.com.

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