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
  • Verified Answer

    I'm not sure why field Z wouldn't retain its new value, unless you are clearing it on form load.

    Can you fire the orchestration from the notification, instead of the transition? Then you pretty much define exactly the rule you want and can include Field A Changes.
  • I am not sure whether you can fire orchestrations from notifications, it has not been something I have actually looked into... do you know if this is possible? However, what I am trying to achieve is complex server side validation using a web service method, so the idea was to use a synchronous orchestration on my transition, so that I can then throw an error and prevent the transition from occurring. I am not sure whether you would be able to achieve the same thing and prevent a transition using notifications... I would expect not, but again this is not something I have looked into.
Reply
  • I am not sure whether you can fire orchestrations from notifications, it has not been something I have actually looked into... do you know if this is possible? However, what I am trying to achieve is complex server side validation using a web service method, so the idea was to use a synchronous orchestration on my transition, so that I can then throw an error and prevent the transition from occurring. I am not sure whether you would be able to achieve the same thing and prevent a transition using notifications... I would expect not, but again this is not something I have looked into.
Children
No Data