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

How do I access a dynamically generated field on the Web through LotusScript?

How do I access a dynamically generated field on the Web (using <input name="somename" value="somevalue">) through LotusScript?

To make my question clear, here is one of Dave Hatter's responses from SearchDomino.com to a similar question.

Question:
This question is regarding Domino Development. I want to create a set of fields on the fly for input in a form if the user clicks an action button.

Answer:
On the Web, this is fairly simple. You can create a LotusScript or Java agent that dynamically generates the HTML for the page. I use this particular approach all the time.

Generating the HTML is a lot easier than figuring out what to do with the information after the user submits the form. If you post it to a ?CreateDocument URL, then if the field name doesn't appear on the Notes form, the Domino server will reject the submission. On the other hand, if you put every field on the form that you're generating HTML for, then you defeat the purpose of generating the HTML dynamically.

One way to manage this is by generating HTML that contains two <FORM> tags. For instance, let's say your dynamically generated HTML is a table with three columns and an indeterminate number of rows. The field names are of the form A1, B1, C1, A2, B2, C3 and so on. Since there are no such fields on the Notes form, you want to store the data in the multivalue fields A, B and C in the document. In the default form that Domino creates in the HTML, you include hidden fields A, B and C (either via passthru or by selecting the form option to "generate HTML for all fields"). Then you use passthru to put out a </FORM> tag, and follow that with a new <FORM> tag that is set up such that the user cannot submit it. After that, put your dynamically generated fields, then a </FORM>.

On the first form, write JavaScript "onsubmit" event that harvests the data from the dynamically generated fields in the second form and assigns the hidden multivalue fields A, B and C. Assuming that there are not validation issues with this data, the onsubmit event will then allow the submission to proceed. Since you are submitting the first form, the names of the dynamic fields will not be sent to the server, but the data you copied from them will be. This is a good way to work with a table of information, since having lots of separate fields makes it impossible to display all the values with simple formulas on the form or in a view.

Another alternative is to have just one

tag, but do not submit it to a formName?CreateDocument URL command -- instead, submit it to an agentName?OpenAgent URL. The agent can read the RequestContent CGI variable from the context document and parse that information to get the field values that were submitted. The sample database you can download here contains an example of this approach.
This was last published in February 2005

Dig Deeper on LotusScript

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close