How do I validate IP address for a textfield

Certified Lead Developer

I have a text field on which I want to have validations for IP address

  Discussion posts and replies are publicly visible

Parents
  • Hi vinita Jain,
    Below code may be useful to you,
    a!textField(
    value:ri!ruleinput,
    saveInto: ri!ruleinput,
    validations: {
    if(like(ri!ruleinput,"^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$"),"True message","False message")
    },
    refreshAfter: "KEYPRESS"
    )
Reply
  • Hi vinita Jain,
    Below code may be useful to you,
    a!textField(
    value:ri!ruleinput,
    saveInto: ri!ruleinput,
    validations: {
    if(like(ri!ruleinput,"^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$"),"True message","False message")
    },
    refreshAfter: "KEYPRESS"
    )
Children