Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Completion status with nested if statements?


Level 2

I need something similar to the following script that is not working:

In theory, I would put the script in the "calculate" event of a text field called "Completion Status."

if(Subform.TextField1.rawValue !== null && Subform.TextField2.rawValue !== null && Subform.TextField3.rawValue !== null &&

Subform.TextField4.rawValue !== null &&

((TableSubform.Table.Row1.TextField5.rawValue == null && (TableSubform.Table.Row1.TextField6.rawValue == null && (TableSubform.Table.Row1.TextField7.rawValue == null) ||

((TableSubform.Table.Row1.TextField5.rawValue !== null && (TableSubform.Table.Row1.TextField6.rawValue ==  "Yes" && (TableSubform.Table.Row1.TextField7.rawValue == null) ||

((TableSubform.Table.Row1.TextField5.rawValue !== null && (TableSubform.Table.Row1.TextField6.rawValue ==  "No" && (TableSubform.Table.Row1.TextField7.rawValue !== null)) &&

((TableSubform.Table.Row2.TextField5.rawValue == null && (TableSubform.Table.Row2.TextField6.rawValue == null && (TableSubform.Table.Row2.TextField7.rawValue == null) ||

((TableSubform.Table.Row2.TextField5.rawValue !== null && (TableSubform.Table.Row2.TextField6.rawValue ==  "Yes" && (TableSubform.Table.Row2.TextField7.rawValue == null) ||

((TableSubform.Table.Row2.TextField5.rawValue !== null && (TableSubform.Table.Row2.TextField6.rawValue ==  "No" && (TableSubform.Table.Row2.TextField7.rawValue !== null))




} else {

this.rawValue="Not complete"

Basically, I have a form with four fields on top that need to be completed. Then, I have a three column table (first row being the header) with two rows of fillable text fields with the following rules in order for the form to be deemed complete:

If TextField5 is blank, then TextField6 and Textfield7 do not need to be filled in

If TextField5 is not blank, then TextField6 needs to be filled in with "Yes" or "No"

If TextField6 is "Yes," then TextField7 does not need to be filled in

If Textfield6 is "No," then TextField7 does need to be filled in

Please let me know where my script went wrong! Thanks!

0 Replies