dateField

for the date field need to show in red colour when then date is less than today else no colour 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Need more details are you trying to capture the date or you just want to show already existing date. 

    If it's capturing and you using date field , we can't change the colors but we can write validations (That's how the component is). If it's just showing the captured date we  got various options.....(Rich text field). 

    For Capturing We can do it in this way but i don't recommend it for better UI/UX

    a!localVariables(
      local!date,
      {
        a!cardLayout(
          contents: {
            a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!cardLayout(
                      style: if(
                        a!isNullOrEmpty(local!date),
                        null,
                        if(local!date < today(), "ERROR", null)
                      ),
                      showBorder: false,
                      contents: a!dateField(
                        label: "Date",
                        labelPosition: "ABOVE",
                        value: local!date,
                        saveInto: {local!date},
                        validations: {}
                      )
                    )
                  }
                ),
                a!columnLayout(contents: {})
              }
            )
          },
          height: "AUTO",
          style: "TRANSPARENT",
          marginBelow: "STANDARD"
        )
      }
    )

Reply
  • 0
    Certified Senior Developer

    Need more details are you trying to capture the date or you just want to show already existing date. 

    If it's capturing and you using date field , we can't change the colors but we can write validations (That's how the component is). If it's just showing the captured date we  got various options.....(Rich text field). 

    For Capturing We can do it in this way but i don't recommend it for better UI/UX

    a!localVariables(
      local!date,
      {
        a!cardLayout(
          contents: {
            a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!cardLayout(
                      style: if(
                        a!isNullOrEmpty(local!date),
                        null,
                        if(local!date < today(), "ERROR", null)
                      ),
                      showBorder: false,
                      contents: a!dateField(
                        label: "Date",
                        labelPosition: "ABOVE",
                        value: local!date,
                        saveInto: {local!date},
                        validations: {}
                      )
                    )
                  }
                ),
                a!columnLayout(contents: {})
              }
            )
          },
          height: "AUTO",
          style: "TRANSPARENT",
          marginBelow: "STANDARD"
        )
      }
    )

Children