You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Apache Wiki <wi...@apache.org> on 2006/05/02 05:46:59 UTC

[Jakarta-tapestry Wiki] Trivial Update of "BeanForm" by DanielGredler

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jakarta-tapestry Wiki" for change notification.

The following page has been changed by DanielGredler:
http://wiki.apache.org/jakarta-tapestry/BeanForm

------------------------------------------------------------------------------
  <span jwcid="@BeanForm" bean="ognl:pojo" save="ognl:listeners.save" delete="ognl:listeners.delete"/>
  }}}
  
- The above code gets you a form that will call save() when submitted for save, delete() when submitted for delete, displays !TextFields for the bean's string and numerical properties, Checkboxes for its boolean properties and !DatePickers for its date properties, and automatically disables fields for read-only properties. Properties are discovered via [http://java.sun.com/docs/books/tutorial/javabeans/index.html bean introspection]. You can use the BeanForm with a single line, as above, or you can include it inside one of your existing Forms, in which case the internal Form component will not be generated. It's your choice.
+ The above code gets you a form that will call save() when submitted for save, delete() when submitted for delete, displays !TextFields for the bean's string and numerical properties, Checkboxes for its boolean properties and !DatePickers for its date properties, and automatically disables fields for read-only properties. Properties are discovered via [http://java.sun.com/docs/books/tutorial/javabeans/index.html bean introspection]. You can use the BeanForm with a single line, as shown above, or you can include it inside one of your existing Forms, in which case the internal Form component will not be generated. It's your choice.
  
  You can also specify exactly which properties you want included in the BeanForm, as well as cancel and refresh listeners and any of the other parameters supported by the [http://jakarta.apache.org/tapestry/tapestry/ComponentReference/Form.html Form component]. When you explicitly specify the editable properties, those properties are shown on the page in the order you specify:
  
@@ -14, +14 @@

  <span jwcid="@BeanForm" bean="ognl:pojo" properties="ognl:'name,email,comment'" save="ognl:listeners.save" cancel="ognl:listeners.cancel" refresh="ognl:listeners.refresh" />
  }}}
  
- The generated HTML is a form containing a two-column table (unless the BeanForm is already inside a Form, in which case another Form is not generated). The left column contains the field labels and the right column contains the data entry fields. The bottom row spans both columns and contains the save button, the cancel button (if the ''cancel'' parameter was specified), the refresh button (if the ''refresh'' parameter was specified) and the delete button (if the ''delete'' parameter was specified). The table can be styled using CSS: the table's CSS class is ''beanFormTable'', the left column's CSS class is ''beanFormLeftColumn'', the right column's CSS class is ''beanFormRightColumn'', and the bottom column that contains the buttons has the CSS class ''beanFormButtonColumn''.
+ The generated HTML is a form containing a two-column table (unless the BeanForm is already inside a Form, in which case another Form is not generated). The left column contains the field labels and the right column contains the data entry fields. The bottom row spans both columns and contains the save button (if the ''save'' parameter was specified), the cancel button (if the ''cancel'' parameter was specified), the refresh button (if the ''refresh'' parameter was specified) and the delete button (if the ''delete'' parameter was specified). The table can be styled using CSS: the table's CSS class is ''beanFormTable'', the left column's CSS class is ''beanFormLeftColumn'', the right column's CSS class is ''beanFormRightColumn'', and the bottom column that contains the buttons has the CSS class ''beanFormButtonColumn''.
  
  If you need to customize any of the input fields, you can do so by adding a Block component to your page (with the id ''"[propertyName]!BeanFieldBlock"'') that contains any I!FormComponent (with the id ''"[propertyName]!BeanField"''). Doing this will also allow you to edit properties that are considered non-editable by default (ie, not a string / boolean / number / date).
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org