We have a scenario where a pre validation plugin check to see if there are any records with a particular values already in the entity. If there is then a two option set field called new_showerror is updated from No, the default, to Yes.
We have a JavaScript function that is called if the value of new_showerror becomes Yes. The function sends an alert to the screen and prevents the execution of the save.
To stop the execution I have to use the JavaScript on the Save call, but alert does not appear and the save is not prevented because by the time the new_showerror field has been change the page is past the point at which the JavaScript gets called. In short, the field is updated but we never see the alert and we never stop the execuction.
If I put the JavaScript on the new_showerror onChange event I get the error but then I am unable to get the context to prevent the save.
Is there a way of preventing a save from the field change event? Or is there another way of going about this completely?
Thanks for your time.