Date field component

Certified Associate Developer

Hi All,

        I have used date field components.In that   I have two buttons with it like submit and cancel. When ever I enter invalid date and cancelled it and I again edit it it showing the invalid date as a default even though it is not storing in any of the localvariables.

Any leads can be really helpful ..

Thanks & Regards

Divya

  Discussion posts and replies are publicly visible

  • 0
    Certified Senior Developer

    Hi, is validate true for your cancel button?

  • 0
    Certified Associate Developer
    in reply to ujjwalrathore

    @ujjwal,It is not  a button but a rich text component.

  • 0
    Certified Senior Developer
    in reply to Divya

    Ohh sorry my bad as we can see the date in the input is not in the proper format it is therefore not taking it and saving it.

  • 0
    Certified Associate Developer
    in reply to ujjwalrathore

    Ujjwal,Our requirement is if we give invalid date and cancel it.In cancel we are giving olddate,but it is not storing invalid date anywhere but it is showing in the datefield..

  • 0
    Certified Senior Developer
    in reply to Divya

    Can you share your code snippet.

  • 0
    Certified Lead Developer
    When ever I enter invalid date and cancelled it and I again edit it it showing the invalid date

    Can you explain in more detail here what you're doing, and what's happening that you believe is incorrect?  Are you just looking in the Interface Editor when you're seeing this behavior?

  • 0
    Certified Senior Developer

    Hi Divya, can you share the code for your date field configuration?

  • 0
    Certified Associate Developer
    in reply to GopalK

    a!localVariables(
    local!postingDate: todate("10/10/2022"),
    local!editPostingDate: false(),
    local!oldPostingDate: null,
    {
    a!richTextDisplayField(
    label: "Posting Date",
    labelPosition: "COLLAPSED",
    value: { "Posting Date" }
    ),
    a!richTextDisplayField(
    labelPosition: "COLLAPSED",
    value: {
    a!richTextItem(
    text: local!postingDate,
    link: a!dynamicLink(
    value: local!editPostingDate,
    saveInto: { a!save(local!editPostingDate, true()) },

    ),
    color: "#212121",
    size: "MEDIUM_PLUS"
    )
    },
    showWhen: not(local!editPostingDate)
    ),
    a!dateField(
    value: local!postingDate,
    saveInto: {
    a!save(local!oldPostingDate, local!postingDate),
    if(
    rule!APN_isBlank(local!postingDate),
    a!save(local!postingDate, local!oldPostingDate),
    a!save(local!postingDate, local!currentDate)
    )
    },
    showWhen: local!editPostingDate
    ),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item: a!richTextDisplayField(
    value: {
    a!richTextItem(
    text: "SUBMIT",
    link: a!dynamicLink(
    saveInto: {
    if(
    rule!APN_isBlank(local!postingDate),
    a!save(
    local!ULF_cases,
    a!update(
    local!ULF_cases,
    "postingDate",
    local!oldPostingDate
    )
    ),
    a!save(
    local!ULF_cases,
    a!update(
    local!ULF_cases,
    "postingDate",
    local!postingDate
    )
    )
    ),
    a!startProcess(
    processModel: cons!ULF_PROCESS_MODELS[2],
    processParameters: { ULF_cases: local!ULF_cases }
    ),
    if(
    rule!APN_isBlank(local!postingDate),
    a!save(local!editPostingDate, true),
    a!save(local!editPostingDate, false())
    )
    }
    )
    )
    }
    ),
    showWhen: local!editPostingDate
    ),
    a!sideBySideItem(
    item: a!richTextDisplayField(
    value: {
    a!richTextItem(
    text: "CANCEL",
    link: a!dynamicLink(
    saveInto: {
    a!save(local!postingDate, local!oldPostingDate),
    a!save(local!editPostingDate, false),
    if(
    rule!APN_isBlank(local!postingDate),
    a!save(local!editPostingDate, true),
    a!save(local!editPostingDate, false())
    )
    }
    )
    )
    }
    ),
    showWhen: local!editPostingDate
    )
    }
    )
    }
    )

  • 0
    Certified Associate Developer
    in reply to Mike Schmitt

    a!localVariables(
      local!postingDate: todate("10/10/2022"),
      local!editPostingDate: false(),
      local!oldPostingDate: a!refreshVariable(
        value: local!postingDate,
        refreshOnReferencedVarChange: false()
      ),
      a!cardLayout(
        contents: a!columnLayout(
          contents: {
            a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!richTextDisplayField(
                      label: "Posting Date",
                      labelPosition: "COLLAPSED",
                      value: { "Posting Date" }
                    ),
                    a!richTextDisplayField(
                      labelPosition: "COLLAPSED",
                      value: {
                        a!richTextItem(
                          text: local!postingDate,
                          link: a!dynamicLink(
                            value: local!editPostingDate,
                            saveInto: { a!save(local!editPostingDate, true()) },
                            
                          ),
                          color: "#212121",
                          size: "MEDIUM_PLUS"
                        )
                      },
                      showWhen: not(local!editPostingDate)
                    ),
                    a!dateField(
                      value: if(
                        rule!APN_isBlank(local!postingDate),
                        local!oldPostingDate,
                        local!postingDate
                      ),
                      saveInto: {
                        a!save(local!oldPostingDate, local!postingDate),
                        a!save(
                          local!postingDate,
                          if(
                            rule!APN_isBlank(save!value),
                            local!oldPostingDate,
                            save!value
                          )
                        ),
                        
                      },
                      showWhen: local!editPostingDate
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    a!richTextDisplayField(),
                    a!richTextDisplayField(),
                    a!sideBySideLayout(
                      items: {
                        a!sideBySideItem(
                          item: a!richTextDisplayField(
                            value: {
                              a!richTextItem(
                                text: "SUBMIT",
                                link: a!dynamicLink(
                                  saveInto: {
                                    a!save(local!oldPostingDate, local!postingDate),
                                    a!save(local!editPostingDate, false)
                                  }
                                )
                              )
                            }
                          )
                        ),
                        a!sideBySideItem(
                          item: a!richTextDisplayField(
                            value: {
                              a!richTextItem(
                                text: "CANCEL",
                                link: a!dynamicLink(
                                  saveInto: {
                                    a!save(local!editPostingDate, false),
                                    a!save(local!postingDate, local!oldPostingDate),
                                    
                                  }
                                )
                              )
                            }
                          )
                        )
                      }
                    )
                  },
                  showWhen: local!editPostingDate
                ),
                
              }
            )
          }
        ),
        showShadow: true,
        showBorder: false
      )
    )

    In this code if I give invalid date then I cancel it it is performing correctly but if i again want to edit this it showing previous date. please give me any suggestion regarding this..