Skip to main content
Question

adding dash after 5 character in zip code

  • June 14, 2017
  • 0 replies
  • 64 views

I have a address field and which  is having postal code as a sub field , so my question is like after i am entering 5 numbers a dash symbol must come. Do  i have any native QuickBase option
This topic has been closed for replies.

I presume you are talking about Zip + 4 where there is an optional suffix.

one suggestion is to have the Zip field be called [Zip 5] be a text field and set the field properties to limit to 5 characters.  Then have a field called [Zip 4] and limit to 4 characters.  Show these in add and edit mode.

Then have a formula field

List("-", [Zip 5], [Zip 4])

This presumes that your data entry is by hand and not imported.

  • Author
  • Registered
  • June 14, 2017

  • Author
  • Registered
  • June 14, 2017
If there is any native quick base option Please let me know that one


Other wise using javscript we can do this one

$("#_fid_45").keyup(function() {
    let val = $(this).val();
    if(val.length > 5) {
        let digits = val.split(/(\d{1,5})/);
        let str = "";
        for (let group of digits)
        {
          if (/^\d+$/.test(group))
          {
            str += group + "-";
          }
        }
        str = str.substring(0, str.length - 1);
        $(this).val(str);
    }
});

 Insted of _fid_45 give your fid Id