This is really getting to me now… I have been on this site and have been on tutorial for javascript to find a way to do this and I am really running out of time…I am trying to use javascript to validate all of the fields on the form that the questions have values in it, it should not be this complicated!!! I use a submit button with the filesave and file close command
I have a field on the form that tells me the what question is the last one.
I am trying to loop through the fields but I am getting errors… I am not even sure if I am placing the code at the right place…
I have tried this… and I want my LastPage to let me know when to stop the for loop… but it is not working… obviously I am not using the right code to get the value of that field…
alert(PageNumber.value);
for ( i=1 ; i<PageNumber ; i++ ) {
fieldObj = document.all(“R”+i)
if ( getFieldValue( fieldObj ) == “” ) {
alert ( "Please select a value for Answer No: " + i )
return false;
}
}
return true;
thanks again for the greate help so far… it is very much appreciated…
Subject: RE: Getting fustrated with this javascript code…
I presume you are using PageNumber as a javascript variable. And the field which contains the Last Page value is called LastPage, so try the following :
Subject: RE: Getting fustrated with this javascript code…
That is greate the javascript is now working thanks so much…
I still have an issue with my code… does it ever end…
I am trying to write to the document so that on the $$return I would tell the user if they pass or failed… I dont seem to have access to the field on the document
I have a field call CorrectAnswers on the form and it contains the correct answers from the quiz, I also have a field call WebCorrectAnswer this is to hold all of the answers from the users selection on the web, in that field I have Answer1: Answer2… I am not even sure if it is being set , cause I cannot see it from the print statement. I wuold think that the script is good… but i guess not. any ideas LoNo again…
Dim session As NotesSession
Set session = New NotesSession
Dim doc As NotesDocument
Set doc = session.DocumentContext
PageNumber = doc.GetItemValue("LastPage")
Print PageNumber
Dim matchs As Integer
matchs = 0
Forall i In PageNumber
Print "i" & i ' i is 11, I would think that i is 1
If doc.WebCorrectAnswer(i) = doc.CorrectAnswers(i) Then
test = doc.WebCorrectAnswer(i) ' test is showing nothing on the print...
Print "test" & test
matchs = matchs + 1
Print matchs & "matchs"
doc.matchs = matchs
If Cint(PageNumber/2) >= matchs Then
doc.PassQuestion = "Pass"
Else
doc.PassQuestion = "Failed"
End If
End If
End Forall