Friday 7 March 2008

Validators and hidden fields

It seems that there is a strange bug with validators.

If the field that is being validated is hidden in some circumstances a Java error " 'null' is null or not a object"

This doesn't happen on all servers / clients, the problem on site was produced on the clients IIS but on our one wasn't showing, this is with the same code running.
It also didn't happen with a previous version that had one less validator.

The solution was to move the validators next to the actual fields that were being validated. The validation messages were being shown in a validator summary.

The only way I could reproduce it in the office, was to move the post buttons off the Update panel and to do a full postback. This error continued to happen on site, even if I disabled the validators for the hidden control.s