Copy link to clipboard
Copied
Hi all,
I need some help. I have a form that has a field (Total Funding Request) that can be filled in by someone entering a value or a sum of 3 other fields (Year 1 Multi Funding, Year 2 Multi Funding and Year 3 Multi Funding).
On those 3 fields I have under ‘Validate’ the 'Field value range' set, From:25000 To: 0 (as I want the numbers entered to be equal to or greater than 25,000 – not less – and up to any number – that is why I set 0).
I have the ‘Total Funding Request’ field to ‘Calculate’ – ‘Value is the – ‘Sum (+)’ and I have picked the 3 fields (Year 1 Multi Funding, Year 2 Multi Funding and Year 3 Multi Funding). I also have under 'Validate' ‘Field value is in range’ set, From:25000 To: 0 (as I want the number entered to be equal to or greater than 25,000 – not less – and up to any number – that is why I set 0).
The problem I am having is with (I think) the ‘Field value range’ on the ‘Total Funding Request’. If I put numbers in the three multi-year funding fields (and as long as they are over the 25,000 value) I get no warning. However, if I bypass the multi-year fields and go straight to the ‘Total Funding Request’ and put in a value, even if it’s over 25,000, I get a message that pops up that says: Invalid value: must be greater than or equal to 25,000. If I take the validation off I no longer get the error but I need it there if someone doesn’t choose the multi-funding option and goes straight to the ‘Total Funding Request’.
Is there some kind of script that can allow someone to put a value in to the ‘Total Funding Request’, restrict the value to be equal to or greater than 25,000 and won’t give me the warning that the value must be greater than 25,000?
Thanks
Copy link to clipboard
Copied
If you set 'Field value is in range:' as you originaly intended, you can use this as 'custom calculation script' of "Total Funding Request" field:
var a = Number(this.getField("Year 1 Multi Funding").value);
var b = Number(this.getField("Year 2 Multi Funding").value);
var c = Number(this.getField("Year 3 Multi Funding").value);
if(a==0 && b==0 && c==0)
event.rc = false;
else
event.value = a+b+c;
Copy link to clipboard
Copied
This is possible with a custom validation script.
Copy link to clipboard
Copied
You can use this code as the field's custom validation script:
if (event.value && Number(event.value)<25000) {
app.alert("The value must be 25,000 or more.");
event.rc = false;
}
Copy link to clipboard
Copied
This won't work, if OP put this code in fields as validation and still use sum+ it will still give alert when manually enter value.
Copy link to clipboard
Copied
Good morning Asim123,
As you stated I did put this in the 'Run custom validation script" and I still did get the warning alert. Is there a script I can put in the "Custom calculation script" that would eliminate the warning alert from comming up? Or is this an impossible request?
Copy link to clipboard
Copied
Thanks Try67,
I did put this script in but as Asim123 mentioned I still got the warning alert. Is there a custom script I would need in the Calculate tab to make this work?
Copy link to clipboard
Copied
The warning comes from the script. Just remove that line from it.
Copy link to clipboard
Copied
Sorry Try67,
I'm not sure what line you are refering to as I don't know scripting and I'm confused as I thought the script was to validate the field for a number equal to/over 25,000 and stop the alert from poping up if the number was over 25,000.
Copy link to clipboard
Copied
This line:
app.alert("The value must be 25,000 or more.");
Copy link to clipboard
Copied
Thanks Try67,
I took that line out and I no longer get the warning but basically if someone puts a value that is under 25,000 it just doesn't allow that number to go in.
Is there no way to have the warning come up for values below 25,000 but no warning to come up for values equal to or greater than 25,000? Your orginal script had the warning come up in both senerios and now it doesn't come up at all leaving the person to wonder why it won't take their number (eventhough they should know that the application is for greater than 25,000).
Thanks again for helping me out.
Copy link to clipboard
Copied
If you set 'Field value is in range:' as you originaly intended, you can use this as 'custom calculation script' of "Total Funding Request" field:
var a = Number(this.getField("Year 1 Multi Funding").value);
var b = Number(this.getField("Year 2 Multi Funding").value);
var c = Number(this.getField("Year 3 Multi Funding").value);
if(a==0 && b==0 && c==0)
event.rc = false;
else
event.value = a+b+c;
Copy link to clipboard
Copied
Setting the event.rc property in a calculation script is not the right way of doing it. Instead, just set the field's value to be empty, or zero.
Copy link to clipboard
Copied
Find more inspiration, events, and resources on the new Adobe Community
Explore Now