lambsan
asked on
client side vbScript formcheck for multiple select box
I need to put the following javascript fromcheck into client side vbscript and I'm not sure of the syntex.
Basically the code needs to check that not more than 10 keywords have been selected before the form can be posted
for(i=0;i<document.form1.K eywords.le ngth;i++)
{
if(document.form1.Keywords [i].select ed) iCount++;
}
if(iCount > 10)
{
mess = mess + "\nA maximum of 10 keywords";
}
}
Thanks
Basically the code needs to check that not more than 10 keywords have been selected before the form can be posted
for(i=0;i<document.form1.K
{
if(document.form1.Keywords
}
if(iCount > 10)
{
mess = mess + "\nA maximum of 10 keywords";
}
}
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for that,
Unfortunetly I don't think I can use this technique, as I'm using a clientside vbscript function to assign permissions to network folders but beofre I call this function, I need to check the form, both need to run before the form is submitted.
For Each strUser in Document.VolumeDetails.Ass ignUser
MsgBox "Selected Users:" & Document.VolumeDetails.Ass ignUser.Va lue
Next
I've put this together but it displays the message box for every item in the list (not every selected item) and then it just shows the first selected item,
Its driving me mad!
Unfortunetly I don't think I can use this technique, as I'm using a clientside vbscript function to assign permissions to network folders but beofre I call this function, I need to check the form, both need to run before the form is submitted.
For Each strUser in Document.VolumeDetails.Ass
MsgBox "Selected Users:" & Document.VolumeDetails.Ass
Next
I've put this together but it displays the message box for every item in the list (not every selected item) and then it just shows the first selected item,
Its driving me mad!
ASKER
Thanks for your suggestion,
I finally figured it out which is below in case anyone ever needs it
For Each objKeyword in TheForm.Keywords
If objKeyword.selected Then
i = i + 1
End If
Next
If i > 10 Then
strMessage = strMessage & vbcrlf & " - A maximum of 10 Keywords"
blnDataMissing = True
End If
I finally figured it out which is below in case anyone ever needs it
For Each objKeyword in TheForm.Keywords
If objKeyword.selected Then
i = i + 1
End If
Next
If i > 10 Then
strMessage = strMessage & vbcrlf & " - A maximum of 10 Keywords"
blnDataMissing = True
End If
ASKER
Unfortunetly I don't think I can use this technique, as I'm using a clientside vbscript function to assign permissions to network folders but beofre I call this function, I need to check the form, both need to run before the form is submitted.
For Each strUser in Document.VolumeDetails.Ass
MsgBox "Selected Users:" & Document.VolumeDetails.Ass
Next
I've put this together but it displays the message box for every item in the list (not every selected item) and then it just shows the first selected item,
Its driving me mad!