Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Need 'if' script

Avatar

Level 2

Hello,

I have a form in which one of the fields (total repairs: Total_Repairs) is a sum of other fields (repair items: IR1, IR2, ER1, ER2).

I would like the total repairs field to have a default of 0 as long as nothing is entered in any of the repair items fields.

What would the script look like?

Thank you,

Caroline

3 Replies

Avatar

Level 7

You don't have to script that, you can just put a zero in the default field on the Value tab.

Avatar

Level 2

That was my first thought, but it shows in the value tab: Type: 'calculated -Read Only' and there is no option

to put a default value, or any other option available...

Avatar

Level 10

You probably might have a script written in Calculate event..

If that is true, try placing the below code in your Calculate event after all of your script.

Language: FormCalc

if($.rawValue == null) then
$.rawValue = 0;
endif

Thanks

Srini