Hello all I got some help with this 6 months or so ago, and it seems that something happened and it's not working anymore.
Here is what I need to achieve.
We are doing versioned cards for a school for the blind. The front is sighted text, and the back get's embossed with braille for dual use.
I got help getting a code that would allow the user to enter in their phone number, and it would convert it to US English 2 braille. (IE the numbers become letters.) it was working fine for a while, now it's no longer working. A note we do not use what get's generated for anything more than a proof, another vendor does the braille embossing.
Here is the variable, if they want the same phone in braille that is in phone 1 we allow them leave the braille phone line blank.
Here is the code I have been using.
This job resides on an EFI/Digital Store front site, and is allowed for one off use only. Any ides why I'm not getting the result i'm looking for?
Var1 = Field("Phone1")
Var2 = Field("Braille Phone")
if (Field("Braille Phone") =="")
return formatBraille(Field("Phone1")); // #617-555-1234
else
return formatBraille(Field("Braille Phone")); //#+617-555-1234
////
function formatBraille(number) {
number = number
.split('')
.map(function(s) { return /\d/.test(s) ? Chr(96 + Int(s)) : s; })
.join('')
.replace(/[^a-j]/gi, '')
.match(/^(.{3})?(.{3})(.{4})$/);
if (!number) return '';
number.shift();
return '#' + number.filter(Boolean).join('-');
}
Thank you
Sean