WebQuerySave event not working for me

I need to find out if user passes a test or not right away when he/she submit the test.

I have a field on the form that has the answer fieldAnswers = a;d;e;b;c;a;e;

and a field usersAnswer that is not filled yet has she/he is answering the quiz.

Here is the code I have in the WebQuerySave event… it is not working. I am not sure if the doc is the web current documeent

how can I make this work?

Dim session As NotesSession

Set session = New NotesSession

Dim doc As NotesDocument

Set doc = session.DocumentContext

PageNumber = doc.GetItemValue(NumberOfQuestions)



Forall i In NumberOfQuestions 

	If doc.fieldAnswers(i) = doc.usersAnswer(i) Then

		matchs = matchs + 1

		Messagebox  matchs

		doc.matchs = matchs

	End If

End Forall 

End Sub

thanks,

Alena

Subject: WebQuerySave event not working for me.

that will work in java but I dont believe that method is available in script. The issue is with her for statement

For i = 0 to Ubound( PageNumber )

If doc.fieldAnswers(i) = doc.usersAnswer(i) Then

matchs = matchs + 1

doc.matchs = matchs

End If

End Forall

That should work.

Subject: RE: WebQuerySave event not working for me.

yep, lloks like I was Madly Off in the WRONG direction.Sorry for the bad lead.

Shawn

Subject: WebQuerySave event not working for me.

Messagebox wont work on the web. Try using a Print statement to print it to the browser.

Subject: RE: WebQuerySave event not working for me.

I did try Print… but the code is still not setting the field

Subject: RE: WebQuerySave event not working for me.

Try to add quotes around NumberOFQuestions in the getitemvalue and PageNumber to the for statement instead of NumberOfQuestions. For web agents it is much easier to debug with Agent logs.

Dim session As NotesSession

Set session = New NotesSession

Dim doc As NotesDocument

Set doc = session.DocumentContext

PageNumber = doc.GetItemValue(“NumberOfQuestions”)

Forall i In PageNumber

If doc.fieldAnswers(i) = doc.usersAnswer(i) Then

matchs = matchs + 1

Messagebox matchs

doc.matchs = matchs

End If

End Forall

End Sub

Subject: RE: WebQuerySave event not working for me.

Tyson/Alena,

I believe the method is ‘getDocumentContext’.

Try this:

Set doc = session.getDocumentContext

Shawn