I changed the code to AjaxFormComponentUpdatingBehavior but it seems the js
generated by this behavior
getCallbackScript() is the same with AbstractDefaultAjaxBehavior and I have
same results if I call that script from
my flash component.
..
function load_orase(){
var
wcall=wicketAjaxGet('?wicket:interface=:0:sidebar:oraseForm:judetSelectat::IBehaviorListener:0:',null,null,
function() {return Wicket.$('judetSelectat2') != null;}.bind(this));
alert('ok');
}
..
Indeed AjaxFormComponentUpdatingBehavior generate on my field 'onchange'
attribute js which is good. How can I intercept this script and call it
programatically.
<input wicket:id="judetSelectat" type="text" value=""
name="judetSelectat" id="judetSelectat2"
onchange="var
wcall=wicketAjaxPost('?wicket:interface=:0:sidebar:oraseForm:judetSelectat::IBehaviorListener:0:',
wicketSerialize(Wicket.$('judetSelectat2')),null,null, function()
{return Wicket.$('judetSelectat2') != null;}.bind(this));"/>
Thank you,
Alexandru
On Thu, Jan 14, 2010 at 3:25 PM, Pedro Santos <[email protected]> wrote:
> You can take a look at AjaxFormComponentUpdatingBehavior, this behavior
> will
> keep the 'judet' field model data updated.
> About the generated id, this is the default behavior, you can override the
> onBind method to avoid id. But later you will can not add the component to
> an AjaxRequestTarget, so see if you can work with the generated id.
>
> On Thu, Jan 14, 2010 at 11:11 AM, Alexandru Barbat <
> [email protected]> wrote:
>
> > Hello,
> >
> > ..
> > AbstractDefaultAjaxBehavior behave = new AbstractDefaultAjaxBehavior() {
> > protected void respond(AjaxRequestTarget target) {
> > target.addComponent(orasListPanel);
> > }
> >
> > public void renderHead(IHeaderResponse response) {
> > super.renderHead(response);
> > response.renderJavascript("function load_orase(){\n" +
> > getCallbackScript().toString() + "\nalert('ok');\n}", "loadOrase");
> > }
> >
> > };
> >
> >
> > TextField judet = new TextField("judetSelectat");
> > judet.add(new SimpleAttributeModifier("id","judetSelectat"));
> > ///xxxxx
> > judet.add(behave);
> >
> > ..
> >
> >
> > I use this to generate a js function in order to call it from flash
> > component but it does't work at all because o line ///xxxx.
> > SimpleAttributeModifier change the element id but the
> > AbstractDefaultAjaxBehaviour doesn;t take that in account.. it use the
> > generated id. This is one problem. How I could overcome that?
> >
> >
> > And second, even if I don't change the id of 'judetSelectat' and even if
> > the
> > behaviour it is called the model of the 'judet' field it is not called.
> > Why?
> >
> >
> > Thank you,
> >
> > Alexandru
> >
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>