Creating Dynamic ADF Input Forms with Iterator

I showed before how to use the dynamic tag library to create dynamic forms/tables that can show an unknown number of fields. While using those tags is very easy, they are meant for read-only data view. What if you actually want to create a page with input fields, but you don't know ahead of time how many fields will be needed?

Well here is a little solution.

It uses an array that lists the fields you'll want to show, and then an iterator in the page to run over this array and display the fields.

Application zip file is here.

And here is a short demo showing the form in action and explaining what is happening behind the scenes.

By the way, in the zipped version I added another button to the page that when pressed adds one more field to the form.


Hi Shay, how are you.

I am just new for Oracle ADF, and I am starting to learn Oracle ADF, and your training session in Oracle official website provide me much more clear overview and direction about ADF.

Now I have the requirements about troubleshooting the application which developed through Oracle ADF 10g and currently have two problems I need to figure out as following:

1. The application is very slow while input data via ADF form.
2. ADF 10g can not support IE8.

Can you please point me at right direction for application checking? Thanks!

Posted by guest on February 20, 2012 at 03:50 AM PST #

guest - These type of questions are better answered on the OTN JDeveloper discussion forum.
While posting there you should probably mention what specifically is not working for you on IE8, and what specifically is slow in your form.

Posted by Shay on February 20, 2012 at 03:54 PM PST #

Hi Shay,

Thanks for your response.

Can you please post the reference post in JDeveloper forum?

I did search, but not found available clue.


Posted by Roy on February 20, 2012 at 05:55 PM PST #

Roy, the JDeveloper forum is here:
You can register and post your own questions there.

Posted by shay on February 20, 2012 at 08:06 PM PST #

Hi shay,

In you sample you have shown dynamic fields as text and and date. is it possible to have List Of Values field also as dynamic and also to have the query for the LOV population also as a parameter in the ?


Posted by Priya on June 04, 2012 at 03:43 AM PDT #

Priya, I would guess that it should be possible to add an LOV field in the same way. You'll probably need to provide more information in your bean about the field (for example the source of the model to the LOV) - but in term of creating the field in the screen it should work.

Posted by Shay on June 04, 2012 at 04:22 PM PDT #

Hi Shay,

Thanks for your response.
As you said to have LOV fields also to be dynamic, I need to provide informations like the source of the model to the LOV. But that is where the challenge lies for me. I am looking for a way to create "listOfValuesModel" in java class, and I do not find any way for that. Is it possible to create ListOfValuesModel through java?


Posted by Priya on June 04, 2012 at 11:37 PM PDT #

Priya, the ADF Faces Components Demo has a screen that demos the LOV component
and in the backing bean for that screen you'll see how to create the model for it in Java.
Download it from here:

Posted by Shay on June 05, 2012 at 09:54 AM PDT #


Thanks for the example..really a great one...
I have one question: you have added a method to add a field to the form..that just works for the first time...I think the new hash value is not getting set to the bean...can you help? Each time just one field remains..I need to add as many fields as user clicks the add button.


Posted by Vik on June 20, 2012 at 11:52 PM PDT #

Hi Shay,
Great Post!!!
I need to extend this functionality,as i have some requirement where i need to set the valueChangeEvent on one of the dynamically created component.Is there any where i can assign the different ID's to them ?

Kindly suggest!!!

Posted by Ankit Shah on July 26, 2012 at 08:06 AM PDT #

Ankit, you should be able to call setValueChangeListener method on the component that you are creating and assign a pre-existing bean method to a specific field.

Posted by Shay on July 26, 2012 at 02:55 PM PDT #

HI Shay
Great example.
One question where I need your help and guidance.

Our business requirement changes over time and the form with its fields are subject to change over time (For example certain questions to be added on the form or disabled from the page over time)
One of our requirement is to create a page(say X) where we define the labels and fields for another page (say Y).The definitions from page X will be stored in the database and page Y will be dynamically rendered through the definition details stored in the database from page X.

For example,
Page: Y
Label: Company Name
Enabled: Yes

So if the user wants, user can disable the content in page X and then the next in sequence(in this example if sequence 1 company name is disabled, sequence2 will be rendered first) will be rendered in the page Y.
Is there a way we can handle it through Dynamic form?

I posted on the discussion forum, didnot get much headway.

Thanks in advance.

Posted by guest on August 09, 2012 at 09:28 AM PDT #

guest - you should be able to use the approach shown here and extend it to your case. Basically you'll have a method that retrieves all the fields that are to be rendered into an array - and then you iterate over that array and render the fields.

Posted by Shay on August 09, 2012 at 12:53 PM PDT #

Hi Shay, thanks for such great post. I have a question, I have my dynamic form in the same page as the button that executes the method in the AM. I'm not sure why, but I have to press the button twice in order to see the dynamic componentes... any ideas? Regards

Posted by aalopez on February 08, 2013 at 02:59 PM PST #

Hi Shay, me again. I found the answer to my previous question, I'm posting it here maybe someone else needs it.


Posted by aalopez on February 14, 2013 at 11:08 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

I'm a Director of Product Management for Oracle's Cloud Development Tools and Frameworks.
Follow me:

« July 2016