This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Forms with dynamic elements
Skip to end of metadata
Go to start of metadata

Occasionally, you'll need to create a form with a variable number of form elements. In my case, I needed to allow the user to define a survey with text fields, text areas, checkboxes and select lists. To solve this, I created a Panel for each element type: TextFieldPanel, TextAreaPanel, etc.

When the form is created, I add each element Panel to a ListView, which is then iterated over in the markup.
The ListView has to use optimizedItemRemovel (see: Using listviews) or form components will forget their content.

I use the same process when I render the survey to the user filling in the survey. I just needed to create a new set of Panels.

See also: Create dynamic markup hierarchies using panels
See also: Page with dynamic components

  • No labels