Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments

Validating Mandatory TextFields in Dynamic Table preSubmit

Avatar

Level 1

Hi Everyone,

I am trying to develop a script that checks the form to ensure that certain fields have been filled in. I am unable to figure out how to check the fields in a dynamic table. The current script I have only checks the first row of the table. I want the script to check any rows that is added by the user. I am new to scripting and would appreciate some guidance. Below is the script:

form1.Section5Subform.SubmitToBudgetsSubform.SubmitToBRPByEmail::preSubmit:form - (JavaScript, client)

if (Section3Subform.SourceBudgetEntryTypeDropDown.rawValue == 1) {

  this.resolveNode("Section4Subform.OneSidedSubform.TransferToTable.Row1[*].OpUnitTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.OneSidedSubform.TransferToTable.Row1[*].FundTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.OneSidedSubform.TransferToTable.Row1[*].DeptIDTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.OneSidedSubform.TransferToTable.Row1[*].CBAccountTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.OneSidedSubform.TransferToTable.Row1[*].DescriptionTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferToTable.Row1[*].OpUnitTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferToTable.Row1[*].FundTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferToTable.Row1[*].DeptIDTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferToTable.Row1[*].CBAccountTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferToTable.Row1[*].DescriptionTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferFromTable.Row1[*].OpUnitTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferFromTable.Row1[*].FundTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferFromTable.Row1[*].DeptIDTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferFromTable.Row1[*].CBAccountTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferFromTable.Row1[*].DescriptionTextfield").mandatory = "error";

} else

if (Section3Subform.SourceBudgetEntryTypeDropDown.rawValue == 2) {

  this.resolveNode("Section4Subform.OneSidedSubform.TransferToTable.Row1[*].OpUnitTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.OneSidedSubform.TransferToTable.Row1[*].FundTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.OneSidedSubform.TransferToTable.Row1[*].DeptIDTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.OneSidedSubform.TransferToTable.Row1[*].CBAccountTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.OneSidedSubform.TransferToTable.Row1[*].DescriptionTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferToTable.Row1[*].OpUnitTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferToTable.Row1[*].FundTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferToTable.Row1[*].DeptIDTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferToTable.Row1[*].CBAccountTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferToTable.Row1[*].DescriptionTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferFromTable.Row1[*].OpUnitTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferFromTable.Row1[*].FundTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferFromTable.Row1[*].DeptIDTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferFromTable.Row1[*].CBAccountTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferFromTable.Row1[*].DescriptionTextfield").mandatory = "disabled";

} else

(Section3Subform.SourceBudgetEntryTypeDropDown.rawValue == 3) {

  this.resolveNode("Section4Subform.OneSidedSubform.TransferToTable.Row1[*].OpUnitTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.OneSidedSubform.TransferToTable.Row1[*].FundTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.OneSidedSubform.TransferToTable.Row1[*].DeptIDTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.OneSidedSubform.TransferToTable.Row1[*].CBAccountTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.OneSidedSubform.TransferToTable.Row1[*].DescriptionTextfield").mandatory = "disabled";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferToTable.Row1[*].OpUnitTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferToTable.Row1[*].FundTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferToTable.Row1[*].DeptIDTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferToTable.Row1[*].CBAccountTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferToTable.Row1[*].DescriptionTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferFromTable.Row1[*].OpUnitTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferFromTable.Row1[*].FundTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferFromTable.Row1[*].DeptIDTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferFromTable.Row1[*].CBAccountTextfield").mandatory = "error";

  this.resolveNode("Section4Subform.TwoSidedSubform.TransferFromTable.Row1[*].DescriptionTextfield").mandatory = "error";

}

Message was edited by: Dennis Ngu

0 Replies