How to access to a control connected to a lotus field using javascript

In this post I test how to access via javascript to the following controls connected to a lotus field:

  • Edit Box: a control for entering a single line of data
  • Hidden Input: a control for hiding data to the user

A Hidden Input control is not such as an Edit Box control with “Visible” unchecked (or with property rendered set to False) because an invisible Edit Box control is not rendered in the page, not even in the html code with an attribute type=”hidden”.

For each of these two cases I consider the case in which the document is in read and edit mode.
To access the control I use a button with a client-side script:

and a button with a client-side script:

  1. create a form with a field named Test
  2. create a document, insert a value in the field, for example “test value” and save it
  3. create a xpage with the following xml code

In this example there is a table with two rows and four columns, containing a label in the first column, the control to be tested in the second one, a button getting the control using the .value property in the third one, a button getting the control using the .innerHTML property in the fourth one and the HTML source of the page in the fifth one.
At the line 85 replace [your form name] with the name of the form created at step 1.

To test the code, open the lotus document with a browser and see what happens using the buttons.
The following table shows the different possibilities:

Control mode .value() output .innerHTML() output HTML code
Edit Box read undefined test value
Hidden Input read undefined
Edit Box edit test value
Hidden Input edit test value

In read mode, you can only get the value of Edit Box control using the .innerHTML(), while in edit mode you can get the values of Edit Box and Hidden Input controls with .value()

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.