Hello,

I have a wicket Panel with the following structure:

1. drop down choice to select value
2. text field to specific contextual value details
3. help link to allow the user to see the applicable help if they want.
4. a hidden (style=display:none) div that contains a wicket panel to show the contextual help.

When the link(3) is clicked a javascript behaviour will toggle the display css attribute to make the help visible/invisible.

The onChange event for the drop down choice(1) invokes an ajax behaviour bound to the contextual help panel (4) and provides the currently selected value.

The ajax behaviour generates the new contextual help panel context and returns it.

The problem I have is in figuring out what wicket-ajax.js method I can call to have the results rendered properly, i.e. correctly replacing the existing contents on the help panel.

Here is the non-working version of the javascript behaviour:

final AbstractBehavior jsBehave = new AbstractBehavior() {

           @Override
public void onComponentTag(Component component, ComponentTag tag) {

               String submitCall = "wicketAjaxGet('" +
                    ajaxBehave.getCallbackUrl(false) +
"&value='+wicketEncode($("+ddc.getMarkupId()+").getValue()))";

               tag.put("onChange", submitCall);

           }
       };

This is the working version that has a dependency on Prototype's Ajax.Updater class.

   final AbstractBehavior jsBehave = new AbstractBehavior() {

           @Override
public void onComponentTag(Component component, ComponentTag tag) {

               // now with the prototype call:
               String submitCall = "new Ajax.Updater("
                       + overlayPanel.getMarkupId() + ", '"
                       + ajaxBehave.getCallbackUrl(false) + "&value='+$("
                       + ddc.getMarkupId() + ").value);";
               tag.put("onChange", submitCall);

           }
       };

Thanks for your help,

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to