Dynamic name/value pairs for HTML select fields

Generate name/value pairs in Domino with a small amount of code.

Generate name/value pairs in Domino with a small amount of code. Concatenate Evaluate statements in a WebQueryOpen agent and have a short formula in the field that will contain the select options. The value (not the label) is passed when the form is submitted.

The HTML for the field that is generated by Domino will look like:

 <OPTION VALUE="1">Briefing Material <OPTION VALUE="2">Memorandum

instead of the list being generated without values and the whole thing being selected by default, which will happen if you just insert a list into the field:

 <OPTION SELECTED>Briefing Material <OPTION SELECTED>Memorandum


WebQueryOpen Agent:

 Dim session As New notessession Dim db As notesdatabase Dim doc As notesdocument Dim tempDoc As NotesDocument Dim nameValuePair() As String Dim x As Integer Set db = session.CurrentDatabase Set doc=session.DocumentContext Set tempDoc = session.CurrentDatabase.CreateDocument ' The type of @DbLookup/Column is irrelevant tempDoc.ValueList = Evaluate ( {@DbColumn("ODBC" : "NoCache" ; "dbname" ; "userid" ; "password" ; "DocType" ; "Doc_Value" : "Discard" ; "Distinct" : "Ascending")}, tempDoc) tempDoc.LabelList = Evaluate ( {@DbColumn("ODBC" : "NoCache" ; "dbname" ; "userid" ; "password" ; "DocType" ; "Doc_Label" : "Discard" ; "Distinct" : "Ascending")}, tempDoc) x = -1 Forall i In tempDoc.ValueList x = x+ 1 Redim Preserve nameValuePair(x) ' Concatenate the input value and input label with pipe character | nameValuePair(x) = tempDoc.LabelList(x) & "|" & tempDoc.ValueList(x) End Forall Call tempDoc.RemoveItem ("ValueList") ' no need to keep the temporary field Call tempDoc.RemoveItem ("LabelList") ' no need to keep the temporary field doc.selectList = nameValuePair() 'insert the concatenated list into the field on the HTML form End Sub

The field on the form (selectList) is an editable dialog list. It uses a formula for choices:

 " " + selectList
This was first published in August 2001

Dig deeper on Domino Resources - Part 4

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-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 ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close