Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Exclude Negative Numbers?

Avatar

Level 1

Is there a way to exclude negative numbers from appearing in numerical (currency) fields?

For instance, if a user were to attempt to enter a negative number in a given field, is there a way to instruct Adobe to erase the entry, or better yet, to prevent the user from doing so?

Thanking you in advance.

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi Susan,

If you are using LC Designer, please use the following script on the exit event of the numeric field in the script editor box

 

if(NumericField1.rawValue<0)

{

NumericField1.rawValue="";

xfa.host.messageBox("Please Enter the positive value");

xfa.host.setFocus(NumericField1);

}

Let me know if that works,

View solution in original post

6 Replies

Avatar

Correct answer by
Employee

Hi Susan,

If you are using LC Designer, please use the following script on the exit event of the numeric field in the script editor box

 

if(NumericField1.rawValue<0)

{

NumericField1.rawValue="";

xfa.host.messageBox("Please Enter the positive value");

xfa.host.setFocus(NumericField1);

}

Let me know if that works,

Avatar

Level 2

Would I be able to possibly use similar function to ignore a drop down field that contains N/A?  Have 8 dropdowns that cotain "N/a, 1, 2, 3" and are all averaged out at the end but need N/A to be ignored if chosen??

Thanks so much n advnace for any help

Avatar

Employee

Hi 41globalit,

Please look into the example 2 attached in the sample file

~Pranav

Avatar

Level 2

This looks like exactly what I am looking for!! Will have to do some small tweaking I think to fit into my file!  Thanks so much!

Avatar

Level 2

Im not expert on coding.  What coding would I need to change?  All drop downs named DropDownList1, DropDownList2, DropDownList3, etc....

here is link to pdf if you'd like to view

http://41global.com/performeval.pdf

Thanks so much,

Message was edited by: 41globalit

Message was edited by: 41globalit

Avatar

Level 2

For example 2 in your pdf, what would be the script i'd need to get things to average instead of it doing sum total??