Hi everyone,
i'm trying to implement a  custom TextField that fires "onchange" event
without using Ajax (it is a requirement of my project - i have good reasons
not to use Ajax).

Looking at the source files of DropDownChoice, CheckBox etc. (they all
implement the "wantOnSelectionChangedNotifications()" mechanism) i created a

class OnChangeTextField<T> extends TextField<T> implements IOnChangeListener

   // ..... my stuff....

   public void onSelectionChanged()

   protected void onSelectionChanged(final Object newSelection)
           System.out.println("Event fired");

* Processes the component tag - This is like DropDownChoice and other
default FormComponents di
   protected void onComponentTag(final ComponentTag tag)
       // url that points to this components IOnChangeListener method
       CharSequence url = urlFor(IOnChangeListener.INTERFACE);

       Form<?> form = findParent(Form.class);
       if (form != null)
           tag.put("onchange", form.getJsForInterfaceUrl(url));

but that doesn't work. When i type into my textfield, i get an error page

WicketMessage: Attempt to access unknown request listener interface

Root cause:

org.apache.wicket.WicketRuntimeException: Attempt to access unknown request
listener interface IRedirectListener
at org.apache.wicket.markup.html.form.Form.dispatchEvent(Form.java:1320)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:870)
at java.lang.reflect.Method.invoke(Method.java:597)

.... etc. etc.

I looked into the sources, in particular Form.java, it seems like the url of
my listener (obtained by "urlFor(IOnChangeListener.INTERFACE)") is wrong,
because this is the value that get stored in the hidden fild of the form,
and when the form dispatches events, it does not cause the correct
IListenerInterfaceRequestTarget be created.

I wonder, why does this mechanism work on DropDownChoice and others, and not
on my component?
Is this a bug? Or am I doing some mistake?

Thanks a Lot

Rut Bastoni

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

Reply via email to