Jump to content

QR Code for contacts


Recommended Posts

When creating a QR code for contacts, there is a property field called "TEL:"

In the vCard spec there are some parameters that can go with the TEL property such as.

 

TEL;WORK;VOICE:(111) 222-2222

TEL;HOME;VOICE:(222) 222-2222

TEL;CELL;VOICE:444-444-44444

TEL;WORK;FAX:(333) 333-3333

 

When I try to use these I get the following error.

 

SyntaxError: missing : after property ID

 

How can I specify the telephone number type in the QR code?

Link to comment
Share on other sites

Great, thanks.

That was the answer.

When using the parameters, I need to put them inside quotes.

Right, in code like this:

var info = {
   // ADD OR REMOVE FIELDS HERE TO MATCH YOUR DATA
   N: FieldOrRule("QR Contact Name"),
   "TEL;WORK;VOICE": FieldOrRule("QR Phone").replace(/\D/g,''),
   "TEL;WORK;FAX": FieldOrRule("QR Fax").replace(/\D/g,''),
   EMAIL: FieldOrRule("QR Email"),
   URL: FieldOrRule("www"),
   ORG: FieldOrRule("Organization"),
   TITLE: FieldOrRule("title1"),
}

It's actually declaring a JavaScript object literal named "info", with a set of properties, one per line, each of which has a name to the left of the colon and a value to the right of the colon. The name of a property can be just about anything, but if it's not a valid identifier, it has to be enclosed in quotes as a string literal. You could put every property name inside quotes in the object literal and that would work fine too.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...