Skip to main content
Question

autoformat user input text field

  • January 16, 2023
  • 0 replies
  • 56 views

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
------------------------------
This topic has been closed for replies.

Forum|alt.badge.img+15
  • Registered
  • January 16, 2023
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
------------------------------