Validating Mandatory TextFields in Dynamic Table preSubmit

64423433

27-04-2016

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

Accepted Solutions (0)

Answers (0)