I have a Submit button script that pulls a phone number raw value from a field, and then places it in the generated e-mail, but it contains no dashes. How do I go about retrieving the first 3 digits, then adding a dash, then next three, then adding a dash, etc.?
Something like this:
Phone1.rawValue(1-3) + "-" + Phone1.rawValue(4-6) + "-" + Phone1.rawValue(7-10)
Thanks for the help.
I have tried this, but it doesn't work:
Phone2 = Phone1.substring(1,3) + "-" + Phone1.substring(4,3) + "-" + Phone1.substring(7,4)
Can someone help?
I got it to work by declaring a variable first. For some reason it wouldn't work just using the substring method directly on the output:
var Phone1 = PhonePOC.rawValue
PhoneWithDashes = String(Phone1.substr(0,3)) + "-" + String(Phone1.substr(3,3)) + "-" + String(Phone1.substr(6,4))
Then I can use PhoneWithDashes elsewhere.