Hello,
how would I implement validation for calculated fields?
AFAIK and tested value constraints only work if the user actually enters a value. But what about calculated fields. For example: Say we have three frields [a], [b] and [c]. [c] is calculated by [a] * [b]. Let's assume that [c] has a mask "nn.nn". Now If [a] and [b] are 10 the result is 100 but the editor displays "00.00".
Is there a way to either empty or display the correct calculated value?
RegardsJohannes
Hello Johannes,
Thank you for posting.
I have been looking into the provided description regarding the displayed value in the editor. On my side the value of the editor is correctly calculated and displayed. I had attached a sample project XamNumEditorCalculatedValues.zip where a mask “nn.nn” is set for the XamNumericEditor. The shown value when [a] is 10 and [b] is 5 is 50,00. Please note that when the mask for the editor is set, the number of displayed digits might be more than the mask allows. For example when you have [a] = 10 and [b] = 10, [c] should be 100,00 but the mask “nn.nn” allows only two digits before the floating point. In order to allow the whole value to be displayed, you could set the mask to “nnn.nn”.
If you have any questions, please feel free to let me know.
Hi Maria,
yes, if I have a value that fits into the mask the value is displayed correctly. That is not the problem though. The problem becomes apparent when a value is bigger then the mask.
In our case we cannot simply increase the mask because that might be configured on the customers side. We have no control over it. What we would like to have is a mechanism to tell the xamnumericeditor not to accept values that do not fit the configured mask.
Is there maybe an input constraint?