Subject: RE: Need to put questions on a form on the web
The problem is that all of the fields have the same name. You need to make sure that every question uses its own field for the answers. That’s just a matter of naming the field using the question document UNID:
Call rtQuestionBody.appendText({<input type="}
& “radio” & {" name=“Answer_} & docQuestion.UniversalID & {” value=} & answers & {>})
It would be nice, though, if you had a smaller unique identifier than the UNID handy (like a field containing @Unique), since the UNID is 32 characters, making the field name ungodly huge.
(NOTE: You are still using an agent to create the test, even if it’s not a freestanding agent that generates all of the web page’s HTML. That is, you aren’t not using my method.)
You will, though, need to create an opening tag on the quiz that submits to an agent, since all of the fields you want to look at are fields that aren’t part of the original form. They can’t be. The “receiving agent” would use the Request_Content field of the DocumentContext:
Dim s As NotesSession
Dim context As NotesDocument
Dim thisDb As NotesDatabase
Dim requestContent As String
Dim answerArray As Variant
Set s = New NotesSession
Set context = s.DocumentContext
Set thisDb = s.CurrentDatabase
requestContent = context.GetItemValue(“Request_Content”)(0)
answerArray = Split(requestContent, “&”)
That will give you an array consisting of “name=value” pairs, so a typical entry in the submitted answers would look like this:
“Answer_5D759BE62A56B9B9852573A8004F75BD=true”
You can use Split with the equals sign to get an array consisting of the fieldname in element 0 and the submitted value in element 1:
“Answer_5D759BE62A56B9B9852573A8004F75BD”
“true”
Use Strright with the underscore to get the UNID of the question document so you can look up the answer, then compare.