Q
Problem solve Get help with specific problems with your technologies, process and projects.

Create dynamic fields on a form

How can I create dynamic fields on a form? I am selecting some values form a multiple drop down box, after selecting the values I have to create text boxes dynamically on the form for each selected value in the drop down box.
The easiest way to do this in a Notes client is to put all of the fields you might possibly need on the form to begin with, and use hide formulas to hide those you're not using at the moment. Set the multi-value field to "refresh fields on keyword change." This will also work in a Web application provided you enable the "Use JavaScript when generating pages" option of the database, and the "Generate HTML for all fields" option of the form. If the multi-value field is called Sections, then your hide formula for the field corresponding to the selection "Financial" would be: !(Sections = "Financial")

If it is not possible to pre-create all of the fields because you don't know at design time what the keyword values are, or because there are just too many, then for a Notes application you don't have any easy way to do this.

If this is a Web application, you can use DHTML -- JavaScript code to manipulate the current page contents -- to add text areas or other fields to an existing form as you are editing it. This is something you might consult a good JavaScript reference to learn how to do -- it's not really a Domino issue. The tricky part then becomes how to submit it to Domino. You can't simply make up field names as you go along and submit it using a "?CreateDocument" URL; Domino only lets you assign fields that it finds on the form. You would instead have to use an agent URL. The HREF attribute of the <FORM> tag would use a URL that ends with "/agentname?OpenAgent", and the agent would have to use the CGI fields in the context document to retrieve the values of the fields and store them somehow in Notes. All this is probably more trouble than its worth, but you can find tools to let an agent read fields from a HTTP PUT operation (as well as many other reusable code bits) here.

Do you have comments on this Ask the Expert question and response? Let us know.

Dig Deeper on Web Development for Lotus Notes Domino

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close