Forum Discussion

RhondaJones's avatar
Qrew Cadet
2 years ago

autoformat user input text field


I want to create a text field that would auto-format a number entered in an open to the public app to include dashes in the correct locations. 

I need a dash after the first two numbers and before the last two numbers when the middle section can vary from one number to four numbers. 

User input 12345678 changes to 12-3456-78
User input 12649 changes to 12-6-49

Any suggestions?

Rhonda Jones

2 Replies

  • DonLarson's avatar
    Qrew Commander
    Two fields would be needed
    Pre Dash,  Text Field
    Dash, Formula Text Field

    This should work for the formula

    // Create Dash Text Output format XX-ABCD....-XX

    // Capture Left Two Characters
    var text LeftTwo = Left([Pre Dash], 2);

    // Capture Right Two Characters
    var text RightTwo = Right([Pre Dash], 2);

    //Capture 1st part of the middle
    var text MiddleOne = NotLeft([Pre Dash], 2);
    // Capture Full Middle
    var text Middle = NotRight($MiddleOne,2);

    // Create the Output

    var text Output = List("-", $LeftTwo, $Middle, $RightTwo);


    Don Larson
    • RhondaJones's avatar
      Qrew Cadet
      Excellent, thank you.

      Rhonda Jones