Jump to content

QR Barcode adding phone numbers


TNoel

Recommended Posts

  • 5 weeks later...

I am trying to do the same, I want multiple numbers ( three to be specific) in my QR Code.

 

Help me out Dan.

 

You posted this in another thread:

 

"The most common is probably the MECARD format:

http://www.nttdocomo.co.jp/english/s...ook/index.html"

 

 

And if you look at the bottom of the page, it does show two TEL: and EMAIL: entries. So it looks to me like it is possible to do. I'm thinking it is more a limitation of the JavaScript to produce the code. It looks to me that if the code sees one field named TEL, but then sees another TEL field, it will ignore the second one.

 

Man, I wish I knew more about JavaScript.

Link to comment
Share on other sites

You posted this in another thread:

 

"The most common is probably the MECARD format:

http://www.nttdocomo.co.jp/english/s...ook/index.html"

 

 

And if you look at the bottom of the page, it does show two TEL: and EMAIL: entries. So it looks to me like it is possible to do.

You're right, you can put more than one "TEL" field into a MECARD entry. But, unlike with vCard, there's no way to distinguish between types of numbers, such as cell, fax, office, etc. (Although there is a separate "TEL-AV" field for a video phone. The Japanese folks who came up with this are living in the future!)

I'm thinking it is more a limitation of the JavaScript to produce the code. It looks to me that if the code sees one field named TEL, but then sees another TEL field, it will ignore the second one.

 

Man, I wish I knew more about JavaScript.

You're also right that the QR Contact Information XML Template rule doesn't allow more than one entry with the same label, because they're just named properties of an object. But that's just a limitation of that particular rule template. It's not too hard just to build up the MECARD data yourself:

var MECARD_data = "MECARD:N:" + Field("Name") + ";TEL:" + Field("Cell") +
                   ";TEL:" + Field("Fax") + ";;"; // etc.
return MakeQRBarcode(MECARD_data);

This could also be reduced to an algorithm like in the template rule.

 

Again, though, while you can encode this into a barcode, and a phone might be able to import multiple phone numbers, there's no way to denote the type of number in MECARD. So I still recommend vCard for that.

Link to comment
Share on other sites

This could also be reduced to an algorithm like in the template rule.

Here's that:

var info = {
   N: Field("Name"),
   TEL: [Field("Cell"), Field("Fax"), Field("Office")],
   EMAIL: "",
   URL: "",
   ADR: "",
   BDAY: "",
   NOTE: "",
}

// do not edit below here

var result = [];
for (var label in info)
{
   var value = info[label];
   if (!value)
       continue;

   if (!(value instanceof Array))
       value = [value];

   if (!label.match(/\:$/))
       label += ":";

   for (var i in value)
       result.push(label + value[i]);
}

if (FusionPro.inValidation)
   return result.join("\n");

var QR = new QRBarcode;
QR.pointSize = 10;
return QR.Make("MECARD:" + result.join(";") + ";");

Note that you can specify an array for multiples of the same field. I don't know how this would translate back into an XML template, though.

 

And, of course, that last line could be changed from QR.Make to QR.MakeGraphic for a graphic rule in FusionPro 7.2.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...