KevMo
KevMo

Reputation: 5610

Richfaces repeating elements

I'm trying to work on a user interface for adding "events". These events have either 0 or many contacts.

Ideally I would like to have an interface that when entering a new event, has a section for contacts, with a little form to enter one contact (name, phone, etc). On the bottom of that mini-form I would like to have a link or button saying "Add another" that would dynamically load another another mini contact form.

Is this possible with rishfaces/jsf?

Upvotes: 0

Views: 726

Answers (2)

Adam
Adam

Reputation: 3795

I believe it is as you would expect. Check out the following link, except replace the words ui:repeat with a4j:repeat

https://rogerkeays.com/jsf-c-foreach-vs-ui-repeat

Upvotes: 0

cetnar
cetnar

Reputation: 9415

Yes, it's doable. Adding another contact have to send ajax event to rerender contact list (addContact method need to result null to remain on the same page). After entering event data and selecting contact list the form will be submitted with event data.

The key elements are:

  • <a4j:commandButton value="Add contact" reRender="contactList" action="#{yourBean.addContact}" >

  • contact list may be created as <rich:orderingList id="contactList" ...> - see demo

If you want that panel with contact form initialy should be hidden you can use rendered property or use any collapsible component like <rich:simpleTogglePanel> or use <rich:modalPanel>

I thing it may help. Take a look of richfaces demo how to use a4j tags.

Upvotes: 1

Related Questions