JavaScript API interaction with server side validation...

I have a field A, which I am trying to detect a change in on the client and then pass a flag to the server in field Z.
I am using AddChangeCallback to set field Z when A changes.
On the server I am able to query field Z to know that A has changed during the transition.

However, I have a field Q which is a required field.
If I change field A and leave field Q blank then the server side validation fails and this causes the page to reload.
When the page is reloaded field A still contains the new value, but I no longer know that this has changed.

Is there a better way to reliably detect changes in the client? At present I am checking whether an error is displayed on page load and if so then I have to assume everything has changed which is not ideal for me. I have submitted another post recently about this... I am trying to call a web service method on the server, but this is an expensive operation and I would only like to do this when a field is actually changed.

Any help or thoughts about this would be much appreciated... thanks!!
Parents Reply Children
  • Yes, that would indeed solve the issue in this particular case and would certainly be an improvement on what I have currently done. The problem is that I have other server side validation and for this to work well I would have to do all my validation on the client, which cannot always be easily done, especially if there is more complex server side validation. I could also not guarantee that someone would not add additional server side validation in future, but I guess I could fall back to my "there is an error so my field might have changed" handling... it's certainly a possible option!