tags:

views:

180

answers:

2

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?

A: 

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

http://www.ilikespam.com/blog/c:foreach-vs-ui:repeat-in-facelets

Adam
+1  A: 

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.

cetnar
aaah, that makes sense to list things in an ordering list. I assume if the users click on the item in the list, I can load it up in the mini form again and have them edit it. Awesome, thanks.
KevMo