I’m trying to write a Server Script that will populated a few hidden fields with different number formats.
I get the error NameError: name ‘format’ is not defined with the following script
def phone_format(n):
return format(int(n[:-1]), ",").replace(",", "-") + n[-1]
doc.phone_e164 = phone_format(doc.phone)
However, the script below does work as intended, so I’m assuming it’s the improper/unsupported use of the format() function.
def phone_format(n):
return n
doc.phone_e164 = phone_format(doc.phone)