I just finished an experiment with something like that. Its still ugly
and very static, but here is my code.

In the HTML header the function you can call from Flash:
function(someValue) {
    var inputEl = document.getElementById('anchor8');
    inputEl.value = someValue;
    eval(inputEl.getAttribute('onclick'));
}

Somewhere in the page:
<form wicket:id="ajaxForm" style="display: none;"><input
wicket:id="myField" type="hidden" value=""/></form>

Note that 'anchor8', the Wicket generated id of the input element, still
needs te be made dynamic. Not sure how yet.


The code:
        Form form = new Form("ajaxForm");
        add(form);
        final HiddenField myField = new HiddenField("myField", new
Model(), String.class);
        form.add(myField);
        myField.add(new AjaxFormSubmitBehavior("onclick") {
            @Override
            protected void onError(AjaxRequestTarget target) {
                throw new RuntimeException("foutje");  // not sure what
to do here
            }

            @Override
            protected void onSubmit(AjaxRequestTarget target) {
                String myValue = (String) myField.getConvertedInput();
                processAjaxRequest(target, myValue);
            }
        });

Improvements are very welcome.

Regards,
    Erik.



Sébastien Piller wrote:
> Hello guys,
>
> I've a little question about the javascript and wicket. I need to
> update some models on server side using javascript (in fact, I need to
> update it from a flash object, and that's why I use js).
>
> But I have no idea about how to do this... I know how to call a JS
> function from flash, but I don't know how to update a wicket model
> using a javascript/ajax call.
>
> Has anybody some hint about that?
>
> Thanks you
>

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

Reply via email to