Hello @andyro,
You have multiple alternatives.
The easier solution would be to enter 0.15 through the “min” attribute in the calculated field’s settings and tick the checkbox “Validate the equation results”. The plugin will display the error message if the equation result is lower than 0.15.
Another alternative would be to display the error message directly as part of the equations.
For example, assuming you have the fieldname1*fieldname2 equation in the calculated field fieldname3 and want to display the error text if the equation’s result is lower than 0.15. In this hypothetical equation, you can edit the equation as follows:
(function(){
let result = fieldname1*fieldname2;
return IF(result < 0.15, 'Error Message', result);
})()
You can even modify the field background and color:
(function(){
let result = fieldname1*fieldname2, background = 'white', color='#cccc';
if(result < 0.15) {
background = 'red';
color = 'white';
}
getField(fieldname3|n).jQueryRef().find('input').css({'background': background, 'color': color});
return IF(result < 0.15, 'Error Message', result);
})()
Additionally, you can insert an “Instruct. Text” field in the form with the error message and configure it as dependent on the calculated field to display it if the equation result is lower than 0.15.
Best regards.
Thread Starter
andyro
(@andyro)
amazing, thanks for the prompt response!
Thread Starter
andyro
(@andyro)
The error is thrown on a readonly field, is it possible to modify the preset warning from ‘Please enter a value greater than or equal to 0.15.’ to ‘Value must be greater than X.XX’? Where does this text reside?