Is there a method to restrict the use of special characters other than "space, (), [], and <>"

Certified Associate Developer

Hello,

Is there a method to restrict the use of special characters other than "space, (), [], and <>" in the text field or paragraph field?

Kind of thinking using validation.

Thank you.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    You can try this :

    a!localVariables(
    local!allspecialCharacters: "`!@#$%^&*-_={}|\/:;'"",.?",
    local!textField: "",
    a!textField(
    label: "Text",
    labelPosition: "ABOVE",
    value: local!textField,
    saveInto: { local!textField },
    refreshAfter: "UNFOCUS",
    validations: {
    if(
    len(local!textField) = 0,
    null,
    if(
    len(local!textField) > len(
    stripwith(
    local!textField,
    local!allspecialCharacters
    )
    ),
    "Special Characters not allowed",
    null
    )
    )
    }
    )
    )

Reply
  • 0
    Certified Senior Developer

    You can try this :

    a!localVariables(
    local!allspecialCharacters: "`!@#$%^&*-_={}|\/:;'"",.?",
    local!textField: "",
    a!textField(
    label: "Text",
    labelPosition: "ABOVE",
    value: local!textField,
    saveInto: { local!textField },
    refreshAfter: "UNFOCUS",
    validations: {
    if(
    len(local!textField) = 0,
    null,
    if(
    len(local!textField) > len(
    stripwith(
    local!textField,
    local!allspecialCharacters
    )
    ),
    "Special Characters not allowed",
    null
    )
    )
    }
    )
    )

Children