Re: PropertyModel doesnt update bean

2009-07-18 Thread granola

the main reason why it doesnt work is pretty much simple. there is no point
in your code where the textfield input is send to the server to put that
into the beans variable. u declared an ajax save button, but how should the
ajax request send to the server through this button know what to to. the
ajax request knows nothing about your textfield. 

first thing to do is, always use a form for input stuff. surrond your field
in markup with form tag and add it in your java class. create a model,
probably a compoundpropertymodel, for your form and pass the form component
instance to the ajax button.

Form form = new Form(form, new CompoundPropertyModel(bean));
FormComponent fc = new RequiredTextField(name);

form.add(new AjaxButton(ajax-button, form) { etc.

the bean should implement iclusterable and have a class attribute named
the same as yout textfields wicket:id





wadi wrote:
 
 Hi all,
 
 I have a UserBean and I created a propertyModel for that
 bean so when a TextField text is modified the property name of the
 UserBean
 updates. I use this in a model windows, added a link so when it clicks I
 use
 the value from the textfield but the value is always null. Should I use a
 form?How can I solve or read about this? Cause everywhere I see
 documentation seems that should work the way I did it.
 
 
 
 userBean=new UserBean();
 
 final PropertyModel messageModel = new
 PropertyModel(userBean,name);
 
  
 
 textField=new TextField(msg,messageModel);
 
 
 
 add(new AjaxLink(Save)
 
 {
 
 public void onClick(AjaxRequestTarget target)
 
 {
 
 modal.close(target);
 
 java.lang.String user = userBean.getName();//this is null
 
  
 
 }
 
 }
 
  
 
 Any help would be appreciated , thanks,
 
 Wadi
 
 
 

-- 
View this message in context: 
http://www.nabble.com/PropertyModel-doesnt-update-bean-tp24535044p24546506.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



PropertyModel doesnt update bean

2009-07-17 Thread Wadi Jalil Maluf
Hi all,

I have a UserBean and I created a propertyModel for that
bean so when a TextField text is modified the property name of the UserBean
updates. I use this in a model windows, added a link so when it clicks I use
the value from the textfield but the value is always null. Should I use a
form?How can I solve or read about this? Cause everywhere I see
documentation seems that should work the way I did it.



userBean=new UserBean();

final PropertyModel messageModel = new
PropertyModel(userBean,name);

 

textField=new TextField(msg,messageModel);



add(new AjaxLink(Save)

{

public void onClick(AjaxRequestTarget target)

{

modal.close(target);

java.lang.String user = userBean.getName();//this is null

 

}

}

 

Any help would be appreciated , thanks,

Wadi



Re: PropertyModel doesnt update bean

2009-07-17 Thread Serkan Camurcuoglu

you should use a form and an ajaxsubmitlink instead of a normal ajaxlink..



Wadi Jalil Maluf wrote:

Hi all,

I have a UserBean and I created a propertyModel for that
bean so when a TextField text is modified the property name of the UserBean
updates. I use this in a model windows, added a link so when it clicks I use
the value from the textfield but the value is always null. Should I use a
form?How can I solve or read about this? Cause everywhere I see
documentation seems that should work the way I did it.




userBean=new UserBean();

final PropertyModel messageModel = new
PropertyModel(userBean,name);

 


textField=new TextField(msg,messageModel);




add(new AjaxLink(Save)

{

public void onClick(AjaxRequestTarget target)

{

modal.close(target);

java.lang.String user = userBean.getName();//this is null

 


}

}

 


Any help would be appreciated , thanks,

Wadi


  



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