Prashant Arkal
Prashant Arkal

Reputation: 308

Dynamically create Xpages form using configuration documents

Is it possible to create Xpages based on some configuration document? Something like Form Builders. Allow user to select what kind of fields and format they want on the form, e.g. Table with some rows which will include fields like Edit box, radio button, check box, drop down list etc. Then generate the XPages based on this configuration document.

Upvotes: 0

Views: 211

Answers (1)

Cameron Gregor
Cameron Gregor

Reputation: 1460

Yes it can be done, the following project 'XPages Bazaar' on OpenNTF is an example of how it is done. You want to look at the 'Interpreter' example. And also there is a dynamic form example somewhere in there I think https://www.openntf.org/main.nsf/project.xsp?r=project/XPages%20Bazaar

Basically the interpreter takes some xml markup representing a page (which could be generated from anywhere you like) and parses it into some information about what controls need to be built, which it then compiles into something like the java representation of a Custom Control. In the example nsf there is a page where you can enter xsp markup into a textarea, and have it preview below so this should be the example that you are looking for.

The author of this XPages Bazaar project was the lead architect of the XPages system so he has a good understanding of how it all fits together, but you could definitely play around with the examples he has given in the example NSF.

If it works for you then there is no reason why not to give it a go! but as Paul said in the comments above you would want to be comfortable debugging any problems as you will probably be on your own.

An alternatively to providing your dynamic form through dynamic Xpages xml markup, you may consider learning about UI Components, and it would be possible for you to dynamically build the necessary 'child components' of the form you need, using java that runs at the appropritate stage of the lifecycle.

It is an interesting area, there is are more than one way to solve problems like this. The more techniques you have, the more you will choose the appropriate one!

Upvotes: 4

Related Questions