you most likely did not give the formcomponent a model.

paste the relevant code

-igor


On 4/28/07, wicket0123 <[EMAIL PROTECTED]> wrote:



when i use getformcomponent.getmodleobject inside the onupdate, it throws
nullpointer exeption.  see code below,

((SignUpFormModel) getFormComponent().getModelObject()).getUserName()

If I use this, i have no problem:

((SignUpFormModel)
getComponent().getParent().getModelObject()).getUserName();

Not sure if this is a bug on wicket or my code...



igor.vaynberg wrote:
>
> if you use wicket validators and the component is invalid the onerror()
> will
> be called instead of onupdate()
>
> the value is available via getformcomponent().getmodelobject() inside
> onupdate()
>
> -igor
>
>
> On 4/27/07, wicket0123 <[EMAIL PROTECTED]> wrote:
>>
>>
>> I want to use ajax to check if a field value is valid w/o submitting
the
>> entire form.  I add AjaxFormComponentUpdatingBehavior to my ajax object
>> (link/button/etc).  But, I don't know how to retrieve the edit field's
>> value
>> inside the onUpdate method.  See the code I have:
>>
>>                 fc = new RequiredTextField("userName");
>>                 fc.setLabel(new Model("User Name"));
>>                 add(fc);
>>
>>                 fc = new Button("checkId");
>>                 fc.add(new AjaxFormComponentUpdatingBehavior("onClick")
{
>>                         protected void onUpdate(AjaxRequestTarget
target)
>> {
>>
>>                                 System.out.println("This gets called");
>>
>>                                 // TODO: how to get the userName
field's
>> value?
>>
>>
>>                         }
>>                 });
>>
>>                 add(fc);
>> --
>> View this message in context:
>>
http://www.nabble.com/how-to-get-a-form%27s-field-when-i-click-on-an-ajax-object-tf3660473.html#a10228341
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>>
-------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>
>
-------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>

--
View this message in context:
http://www.nabble.com/how-to-get-a-form%27s-field-when-i-click-on-an-ajax-object-tf3660473.html#a10237360
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to