Jungle_hacker
Jungle_hacker

Reputation: 9

How to insert multiple input boxes during run time in JSF richfaces

HI,

suppose i have one input box which takes value for mobile no. and when the user wants to add another mobile no at that time user will click 'plus' button. as soon as he clicks the plus button another text box should appear and user should allow to enter another mobile number i want code in JSF richfaces please help me out.

Thanks in advance Jungle_Hacker

Upvotes: 1

Views: 1022

Answers (2)

BalusC
BalusC

Reputation: 1108722

Make use of rich:dataTable or rich:dataList to iterate over an array or collection, displaying an input box on every iteration. The plus button should add a new item to the array or collection everytime and rerender the table or list.

Upvotes: 2

Bozho
Bozho

Reputation: 597106

You can instantiated components in a managed bean of yours. For example:

<a4j:commandButton value="+" action="#{yourBean.addCheckbox}" />

and in your bean something like:

public void addCheckbox() {
     HtmlCheckBox checkBox = new HtmlCheckBox();
     parent.getChildren().add(checkBox); // parent is, for ex. HtmlPanelGroup
}

Upvotes: 1

Related Questions