Setting a field required and non-required conditionally
I have a form with about 8 text fields that are used to mark how many of a certain thing they want to order. If they change any of the values to more than zero, it sets the budget field as required. Currently I'm using the following javascript on the onblur action on the 8 text fields:
// test if field A is greater than 0;
if(event.value > 0) {
this.getField("txtGlCode").required = true;
}
This works and it sets the other field as required. But, I'm having an issue with it going back to non-required if they change their mind. Any ideas? Can I have a hidden field that does a tally and sets it or not? But then how do I subtract values?
Any help would be appreciated.
Thanks
Lacy
