Dynamic name/value pairs for HTML select fields

Dynamic name/value pairs for HTML select fields

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

    Requires Free Membership to View

    Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.

    By submitting your registration information to SearchDomino.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchDomino.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

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

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.