Java Mailing List Archive

http://www.gg3721.com/

Home » users.tapestry »

Setting a default value for input fields

Kai Weber

2010-03-16

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi,

if I have a page with an input field which I want to set to a default
value. After the form was displayed and submitted the value of the input
field should be left alone and not changed anymore. What is the
recommended way to do it? My current solution is the following, but I
feel I miss something. For a text field preferredName I do the
following:

<input t:type="TextField" t:id="preferredName" size="30"/>

@Persist
private String preferredName;

public void setupRender() {
  if (preferredName==null) {
    // preferredName not set already, set default value
    preferredName = "DEFAULT";
  }
}

public void setPreferredName(String name) {
  this.preferredName = name;
}

public String getPreferredName() {
  return this.preferredName;
}

Regards, Kai

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.