How to add new text boxes and check boxes dynamically when clicking on button in JSF
raju.gollapalli raju.gollapalli
Greenhorn
Joined: Oct 23, 2007
Posts: 1
posted
0
How to add new text boxes and check boxes dynamically when clicking on button in JSF. Example : I have one text box and a ADD button, I want enter data in the text box than click ADD buttion, The entered data should be display next line in editable text and with a check box for select to delete. Can any body help me
A. Dusi
Ranch Hand
Joined: Sep 27, 2004
Posts: 114
posted
0
You can do this in two ways: 1. Initially hide the editable textbox and its checkbox and render them only after you submit the form by your Add button. 2. You can create components in the action method: Use a panelGrid and bind it to your backing bean. Once the Add button is clicked, in your action method, add children to the panelGrid binding component. Code will be something like this: In your jsp:
Hi all, I've tried to build a jsf page with dynamic UI Input fields in JSF, with a map that values are bound to it (and all of components are added as children to the PanelGrid tag's component). Any time user clicks on add button 3 new input fields are generated in backing bean and my page rerenders. The problem is : after rendering I can't see values binding to HtmlInputTexts,in fact the values are empty. Here's the code: Backing Bean:
And the jsf page:
Can anybody help me?
Richard Green
Ranch Hand
Joined: Aug 25, 2005
Posts: 536
posted
0
whats the scope of the managed bean 'InputFieldGeneration' ?
session or request?
MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)