Discussions

 View Only
  • 1.  autoformat user input text field

    Posted 22 days ago
    Edited by Rhonda Jones 22 days ago
    Hello,

    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.  RE: autoformat user input text field

    Posted 22 days ago
    Edited by Don Larson 22 days ago
    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);

    $Output

    ------------------------------
    Don Larson
    ------------------------------



  • 3.  RE: autoformat user input text field

    Posted 22 days ago
    Excellent, thank you.

    ------------------------------
    Rhonda Jones
    ------------------------------