Forum Discussion

NingLi's avatar
NingLi
Qrew Trainee
5 years ago

How to set a text field that doesn't allow starting/ending with a extra space?

Hi there, 

How can I set a text field that doesn't allow starting/ending with a extra space?  

When copy and paste, or even manually type in, this text field may contain extra space in the starting and the ending. I found these extra spaces can cause unexpected trouble. How can I to keep the filed type as Text and doesn't allow start/ending extra space? 

Thank you. 

Ning

------------------------------
Ning W
------------------------------
  • Ning,
    Hey there! Here's what came to mind:

    Create a formula checkbox field with the following formula in it:

    Left([Text Field], 1) != " " and Right([Text Field], 1) != " "​

    That field will be checked only when the text field doesn't end with a space. You can require the formula checkbox field on the record to make sure the text field matches your parameters.

    Alternately, you could take your original text field and create a formula field that does the removal of extra space for you.

    Trim([Text Field])​

    would work for that, if you don't mind using a formula field for all the other interactions.

    If you need more help with it, swing by Data Collaborative's free Office Hours, every Thursday at 1pm Eastern.

    Sign up here:
    https://data.quickbase.com/db/bqeqqj33i



    ------------------------------
    - Sam

    ______________________________________________
    Sam Jones
    Vice President, Product and Technology
    he/him

    The Data Collaborative, Inc.
    sjones@datacollaborative.com
    366 Massachusetts Ave, Suite 203 | Arlington, MA 02474
    ------------------------------
    • NingLi's avatar
      NingLi
      Qrew Trainee
      Hi Sam, 

      Thank you very much! I got it. 

      Both trimming and setting a formula check box would solve this problem. Thank you. 
      I will talk with other users about changing existing records (will change the last modify date) and see how would they like the idea of additional formula check box. 

      Many thanks, 

      Ning 


      ------------------------------
      Ning W
      ------------------------------