Hi Nancy,
Validation scripts are useful and provide built-in capabilities you should be aware of.
First, the script is meant to validate the fields value. If the expression is true, the validation will succeed. If false, the validation will fails. If the validation fails, the message specified in Object palette > Value tab > Validation Script Message will be displayed.
Your script should look something like so:
var today = new Date();
var year = today.getFullYear();
(this.rawValue == year || this.rawValue == year+1)
If you check the Error check box beside the Validation Script Message, the user wont be able to submit the form until a valid year is provided. The message should let the user know what value is valid.
Youll notice the script does not reset the fields value if the validation fails. If you choose to do so, you should do it separately. I must say that some users prefer to leave the invalid value untouched. They might have typed 2006, out of habit, and fixing it is a quick as replacing 6 with 7. If you delete their value, they have to retype the entire year. Just a thought.
Regards,
Hélène
Adobe Systems Inc.