How do I use process error message to display an error in a number field if the value is more than $1000 please? Thanks
Priya
How do I use process error message to display an error in a number field if the value is more than $1000 please? Thanks
Priya
First you need to make sure you're using a numeric field type (number, currency, etc.)
Next, in the field configuration, set a minimum and max value (1000)
Lastly, if you want a custom message other than "out of range" you add a rule, type your message, select "value exceeds maximum" or "value out of range" and choose the fields.
If you do a "process" error message, it has to be based on label, type, etc., but if you do a error message on the form itself you can choose the specific field.
Thanks. But Currency field does not allow me to put a maximum. Please help. Thanks.
Priya
Add a custom CSS class to your currency field called "limitedCurrency" and then add the following JavaScript.
$(document).ready(function(){ $('.limitedCurrency input').attr('max',1000); });
Or, you can just get the ID of the field and change the JQuery selector to use that instead of the class/type.
Thanks
I have a table prepoulated with existing rows. If I change the currency in those rows, the validation triggers. But, if I add a new row to the table and populate currency, it does not trigger validation. Any help please?
Thanks
Priya
You're event handler is probably being assigned when the form first loads. The rows are added after, so they didn't get the event handler.
You have to use delegated event handlers to make sure they fire on rows that didn't exist when the form loaded.
Basically,
A delegated handler will monitor the table for changes, then fire when changes occur on your target fields so you don't have to worry about "new" rows.
https://answers.laserfiche.com/questions/153832/Table-and-Collection-JavaScript-Event-Handlers
Thanks
I am using out of the box Error messages feature. I am just assigning the max value of currency field using CSS class as below:
$('.otm input').attr('max',5000);
Is there a way to do this with out of the box please?
Priya
You would need to attach an event handler to the lookupcomplete event.
If you add the max value when the form loads it works on the existing rows, but lookups create new rows that won't have those customizations.
Ok. So, do I do something like below please?
$('.MyTable').on('change',function(e){
$('.otm input').attr('max',5000);
});
I wouldn't do that. That event is going to fire on every single change so it would be triggered by field value changes and run a lot more than you want it to.
Check this post instead
Thanks