You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kerim bey <ke...@gmx.net> on 2008/11/19 13:41:33 UTC

Field value null on Submit after onUpdate()

Hi, Everyone!

I wrot this Ajax Event Handler for a AutoCompleteTextField:

@Override
protected void onUpdate(AjaxRequestTarget target)
{

	ChildObj co = (ChildObj)AutoCompleteTextField.findChoice();
	if(null != co )
	{
		((Obj)Form.getModelObject()).setChildObject(co);
		((Obj)Form.getModelObject()).setPrice(co.getPrice());
		if(co.isBoolAttribute())
		{
			((Obj)Form.getModelObject()).setAmount(new Float(1));
			TextInput.setEnabled(false);
			target.addComponent(TextInput);
		}
		else
		{
			((Obj)Form.getModelObject()).setAmount(new Float(1));
			obj.setAmount(new Float(1));
			TextInput.setModelObject(new Float(1));
			TextInput.setEnabled(true);
			target.addComponent(TextInput);
		}
	}
}

This is working as long as the else-block is not executed bu when I submit
the Form including the AutoCompleteTextField and the TextInput both
AutoCompleteTextField and TextInput have a NULL value. 

Someone please help me what's wrong.
-- 
View this message in context: http://www.nabble.com/Field-value-null-on-Submit-after-onUpdate%28%29-tp20579000p20579000.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Field value null on Submit after onUpdate()

Posted by kerim bey <ke...@gmx.net>.
I debuged some more and realized that only the TextInput ModelObject is null!
Althougt it was not null after filling in a Value (call of onUpdate() of the
TextInput)

Pleas help me someone. This is driving me nuts.


kerim bey wrote:
> 
> Hi, Everyone!
> 
> I wrote this Ajax Event Handler for a AutoCompleteTextField:
> 
> @Override
> protected void onUpdate(AjaxRequestTarget target)
> {
> 
> 	ChildObj co = (ChildObj)AutoCompleteTextField.findChoice();
> 	if(null != co )
> 	{
> 		((Obj)Form.getModelObject()).setChildObject(co);
> 		((Obj)Form.getModelObject()).setPrice(co.getPrice());
> 		if(co.isBoolAttribute())
> 		{
> 			((Obj)Form.getModelObject()).setAmount(new Float(1));
> 			TextInput.setEnabled(false);
> 			target.addComponent(TextInput);
> 		}
> 		else
> 		{
> 			((Obj)Form.getModelObject()).setAmount(new Float(1));
> 			obj.setAmount(new Float(1));
> 			TextInput.setModelObject(new Float(1));
> 			TextInput.setEnabled(true);
> 			target.addComponent(TextInput);
> 		}
> 	}
> }
> 
> This is working as long as the else-block is not executed but when I
> submit the Form including the AutoCompleteTextField and the TextInput both
> AutoCompleteTextField and TextInput have a NULL value. 
> 
> Someone please help me what's wrong.
> 

-- 
View this message in context: http://www.nabble.com/Field-value-null-on-Submit-after-onUpdate%28%29-tp20579000p20657658.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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