[Wicket-user] Conditionally updating model

2005-11-26 Thread Nick Heudecker
Hi,

I have an edit user page that allows the admin to update various
details for a user, like email address, name, etc.  The admin can also
change the password for a user, but I want to make that optional, like
the password is only updated if the admin actually types a new
password, otherwise the User object backing the Form isn't updated
with a blank password.

Is there a suggested way to go about this? Do I end up overriding
getModelValue() or setModelValue()?

Thanks for your time.


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37alloc_id865op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Conditionally updating model

2005-11-26 Thread Andrew Berman
There are a bunch of ways to do it, but I think the easiest way is to override getInput() and return null if you do not want the model updated with this component's value.For example,public String getValue() {
 String val = super.getValue(); if (val != null  val.trim().equals()) return null; return val;}--AndrewOn 11/26/05, 
Nick Heudecker [EMAIL PROTECTED] wrote:
Hi,I have an edit user page that allows the admin to update variousdetails for a user, like email address, name, etc.The admin can alsochange the password for a user, but I want to make that optional, like
the password is only updated if the admin actually types a newpassword, otherwise the User object backing the Form isn't updatedwith a blank password.Is there a suggested way to go about this? Do I end up overriding
getModelValue() or setModelValue()?Thanks for your time.---This SF.net email is sponsored by: Splunk Inc. Do you grep through log filesfor problems?Stop!Download the new AJAX search engine that makes
searching your log files as easy as surfing theweb.DOWNLOAD SPLUNK!http://ads.osdn.com/?ad_idv37alloc_id865opclick___
Wicket-user mailing listWicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user



Re: [Wicket-user] Conditionally updating model

2005-11-26 Thread Andrew Berman
Whoops, my method should be getInput not getValueSorry.Should be:public String getInput() {
 String val = super.getInput(); if (val != null  val.trim().equals()) return null; return val;}On 11/26/05, 
Andrew Berman [EMAIL PROTECTED] wrote:
There are a bunch of ways to do it, but I think the easiest way is to override getInput() and return null if you do not want the model updated with this component's value.For example,public String getValue() {
 String val = super.getValue(); if (val != null  val.trim().equals()) return null; return val;}--Andrew
On 11/26/05, 
Nick Heudecker [EMAIL PROTECTED] wrote:

Hi,I have an edit user page that allows the admin to update variousdetails for a user, like email address, name, etc.The admin can alsochange the password for a user, but I want to make that optional, like
the password is only updated if the admin actually types a newpassword, otherwise the User object backing the Form isn't updatedwith a blank password.Is there a suggested way to go about this? Do I end up overriding
getModelValue() or setModelValue()?Thanks for your time.---This SF.net email is sponsored by: Splunk Inc. Do you grep through log filesfor problems?Stop!Download the new AJAX search engine that makes
searching your log files as easy as surfing theweb.DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37alloc_id865opclick___
Wicket-user mailing listWicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





Re: [Wicket-user] Conditionally updating model

2005-11-26 Thread Eelco Hillenius
Or you could make your models a lit more intelligent, making it
independent of the components. Both are good.

Eelco


On 11/26/05, Andrew Berman [EMAIL PROTECTED] wrote:
 Whoops, my method should be getInput not getValueSorry.

 Should be:

 public String getInput() {
  String val = super.getInput();
  if (val != null  val.trim().equals())
return null;

  return val;
 }



 On 11/26/05, Andrew Berman [EMAIL PROTECTED] wrote:
  There are a bunch of ways to do it, but I think the easiest way is to
 override getInput() and return null if you do not want the model updated
 with this component's value.
 
  For example,
 
  public String getValue() {
   String val = super.getValue();
   if (val != null  val.trim().equals())
 return null;
 
   return val;
  }
 
  --Andrew
 
 
 
  On 11/26/05, Nick Heudecker [EMAIL PROTECTED] wrote:
   Hi,
  
   I have an edit user page that allows the admin to update various
   details for a user, like email address, name, etc.  The admin can also
   change the password for a user, but I want to make that optional, like
   the password is only updated if the admin actually types a new
   password, otherwise the User object backing the Form isn't updated
   with a blank password.
  
   Is there a suggested way to go about this? Do I end up overriding
   getModelValue() or setModelValue()?
  
   Thanks for your time.
  
  
   ---
   This SF.net email is sponsored by: Splunk Inc. Do you grep through log
 files
   for problems?  Stop!  Download the new AJAX search engine that makes
   searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
   http://ads.osdn.com/?ad_idv37alloc_id865opclick
   ___
   Wicket-user mailing list
   Wicket-user@lists.sourceforge.net
  
 https://lists.sourceforge.net/lists/listinfo/wicket-user
  
 
 




---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37alloc_id865op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Conditionally updating model

2005-11-26 Thread Nick Heudecker
I must've been staring at code too much to think of that.  Thanks.


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37alloc_id865op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user