Multiple Choice Picklist On The Web

Many times while developing a web application we need to provide the user with
a list of choices which he/she can choose in the way picklists are implemented
in the notes environment. With the following combination of HTML and Javascript
I will show the developers how to do this easily.
First of all we have to prepare the view which we wish to show to the users. In
this view, we will populate the first column with HTML which will generate a
check box for each row in the view and will have the key field as the checkbox
value. For example:
"[<INPUT TYPE=\"Checkbox\" NAME=\""+CourseCode+"\">]"
Here we are taking the field CourseCode as the primary key. In the other view
columns we can display the other details corresponding to the Course.
Then we will embed this view in a form. In the form properties we will set
"Generate HTML for all fields". Also in Database properties we will set "Web
Access: Use Javascript when generating pages". We will set the embedded view
property to show the view as HTML on the web. On the form we will have a hidden
field named HiddenValues which is a text field which allows multiple values
with semicolon and new line as multi value separators. we will create another
hidden field called SaveOptions of text type with default value of "0". Also in
the onSubmit Javascript event of the form, we will write the following code:
var cnt;
var typ;
for (i=0;i<cnt;i++)
if (typ=="checkbox")
if (document.forms(0).elements(i).checked==true)

On the WebQuerySave event of the form we will put the following command:
@Command([ToolsRunMacro]; "(Checked Retriever)")
Also we will create a button on the form which can be titled as "Submit" and
which will contain the following formulas:

Then we will create an agent named "Checked Retriever" and this agent will be
shared agent, set to run Manually From Agent List and set to Run Once. In this
agent we will write the following code:
Sub Initialize
Dim session As New notessession
Dim db As notesdatabase
Dim doc As NotesDocument

Set doc = session.DocumentContext
Forall vals In doc.HiddenValues
End Forall
End Sub

Now let me discuss how all this works. When we display our form on the web it
shows the embedded view and in the first column of each row it shows a
checkbox. Now when we will press the Submit button, it will fire the onSubmit
javascript event of the form which will populate the hidden field HiddenValues
with the values chosen by the user from the view, using the checkboxes. After
the onSubmit event is fired, the Notes Agent "Checked Retriever" runs which
checks the values in the field HiddenValues. The developers can code this agent
to make better use of the selected values than I have done here by just
printing the selected values.
This was last published in November 2000

Dig Deeper on Domino Resources

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.




  • iSeries tutorials'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 ...