A script can access data in a displayed form with the following command: Form.FieldName.Value (returns the value in a field having the corresponding name).
The example script reads the entered value from the field Field1 and checks it. If it is greater than 500, an error messages is displayed.
Example using VBScript
Sub check_value()
If form.field1.value>500 then
MsgBox "The entered amount is too large!"
End if
End Sub
Example using JavaScript
function check_value(){
if (form.field1.value>500){
alert("The entered amount is too large!");
}
}