How to validate field in FC Validation against JS (Written in SL)?

Hello Experts,

I have written a JS in Script Library for validating IP Addresses according to our environment. I would like to validate the same in device format control. How should I write the same in device FC?

Please help. Few details are below::

FC: device

Tab: Validation

Field: ip.address in $file

 

Regards,

Avi

Top Replies

  • Hi @Avi_hpsm1

    In you fc > Validations tab 

    add: true 

    update: true 

    Validation: jscall("validatingIPAddresses.validateIPaddress", ip.address in $file)

    set focus to:  ip.address 

    message : 'Any message…

  • @Avi_hpsm1

    Try code bellow if it will not fit you requirements share the IP ranges and rules for IP format. 

    function validateIPAddress(ipadress){
    var aNames =  ipadress.split(".")
    var len = aNames.length;…
  • @Avi_hpsm1

    function validateIPaddress(ipaddress) { 
    if (ipaddress) {
    return (/^(^10\.)|(^161\.)|(^172\.)|(^192\.)|(^199\.)|(^204\.)|(^217\.)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]…