dateField saveInto logic executed on invalid date entered

We observed dateField saveInto code executed even though user enters invalid Date manually. We see OOTB validation error message on screen but save logic getting executed successfully.

  =>   =>

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    I'm not sure why you're expecting anything different to happen - your SaveInto attempts to save the value of the entered date, fails, and then executes the other saves as normal (executing the logical path matching local!tempDate being blank, it looks like).

    Do you have some reason to believe it shouldn't work like this?  I don't personally know of any documentation suggesting that when one member of the saveInto array is invalid, that subsequent saves shouldn't complete executing.

    Please see if the attached sample (my own form that's similar to your original one but with some added stuff) helps clarify on this at all for you...

    load(
      local!tempDate: null(),
      local!lastInteractionText: null(),
      local!interactionsCounter: 0,
      
      a!sectionLayout(
        contents: {
          a!dateField(
            value: local!tempDate,
            saveInto: {
              local!tempDate,
              a!save(
                local!lastInteractionText,
                if(
                  rule!GBL_isBlank( save!value ),
                  "Last interaction did not successfully save a valid date.",
                  "Last interaction saved a value successfully."
                )
              ),
              a!save(
                local!interactionsCounter,
                local!interactionsCounter + 1
              )
            }
          ),
          
          a!textField(
            label: "Date Value...",
            value: local!tempDate,
            disabled: true()
          ),
          a!textField(
            label: "Status...",
            value: local!lastInteractionText,
            disabled: true()
          ),
          a!textField(
            label: "Interaction Count...",
            value: local!interactionsCounter,
            disabled: true()
          )
        }
      )
    )

Reply
  • 0
    Certified Lead Developer

    I'm not sure why you're expecting anything different to happen - your SaveInto attempts to save the value of the entered date, fails, and then executes the other saves as normal (executing the logical path matching local!tempDate being blank, it looks like).

    Do you have some reason to believe it shouldn't work like this?  I don't personally know of any documentation suggesting that when one member of the saveInto array is invalid, that subsequent saves shouldn't complete executing.

    Please see if the attached sample (my own form that's similar to your original one but with some added stuff) helps clarify on this at all for you...

    load(
      local!tempDate: null(),
      local!lastInteractionText: null(),
      local!interactionsCounter: 0,
      
      a!sectionLayout(
        contents: {
          a!dateField(
            value: local!tempDate,
            saveInto: {
              local!tempDate,
              a!save(
                local!lastInteractionText,
                if(
                  rule!GBL_isBlank( save!value ),
                  "Last interaction did not successfully save a valid date.",
                  "Last interaction saved a value successfully."
                )
              ),
              a!save(
                local!interactionsCounter,
                local!interactionsCounter + 1
              )
            }
          ),
          
          a!textField(
            label: "Date Value...",
            value: local!tempDate,
            disabled: true()
          ),
          a!textField(
            label: "Status...",
            value: local!lastInteractionText,
            disabled: true()
          ),
          a!textField(
            label: "Interaction Count...",
            value: local!interactionsCounter,
            disabled: true()
          )
        }
      )
    )

Children