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


Level 2


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,


3 Replies


Level 7

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


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...


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;