cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
964
Views
0
Helpful
2
Replies

Dynamic Form Components

nkwok
Level 1
Level 1

Is it possible to have a set of Form Components to be created and displayed dynamically based on the user selection? For example, if I have set of dictionary attributes which I don’t know how much the user will need during ordering, how do I design the form for it. I have seen some examples that the fixed number of set of attributes are set in advanced. I am wonder if those attributes can be created and displayed by clicking on the “Add” button in the form for example, and have the JavaScript to display them? I found they have showField action but not showForm.

2 Replies 2

Mark Swanborough
Cisco Employee
Cisco Employee

It is not possible for them to be "created" dynamically, but it is to show existing form elements dynamically.

If you want up to 10 "Foo"s to be added in an order, you would need to add multiple "Foo" dictionaries (in the current release... this is being addressed in a future release).

This means you would have "Foo_1", "Foo_2", ..., "Foo_10" dictionaries. Define that these fields are hidden, either in a rule or their display properties. It is common practice to have a check box "Add another" in these dictionary, and a Conditional Rule to show the next dictionary. So there would be a Conditional Rule "Foo_1 checkbox show Foo_2", it's condition would be the "Foo_1.showNext == true", and it's action type would be "Show Fields", with dictionary "Foo_2", and "All Fields".

Or you use JavaScript as you suggested with a button. You were close to finding what you were looking for! "serviceForm.dictionaryName.setVisible" is the call, so "serviceForm.Foo_3.setVisible(true)" would work.

As you can see it's complex, and assumed a relatively small maximum number of entries. If you can wait, do so, for new functionality coming in a later release.

(There is another alternative that I have not seen implemented, but I have considered. Write pure JavaScript to add additional form elements to the page DOM. This potentially breaks during a product update, so do at your own risk! Then have JS that reads these values and writes them as a concatenated/formatted string in an existing dictionary - maybe as XML. Then in your Adapter, assuming it is CPO, you can process this formatted string, and do what you like with it.)

Thanks Mark! I guess I will have to wait for the future release. Just wonder if you have any estimate? Months or Years?

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: