Jump to content

1 character font change


Recommended Posts




I've got this little issue here with fonts. I'd like to put that bullet / diamond thing in between these fields. All three fields are different variable fields. But if I just put them in the text box, should one of those three variables be empty, it'll put two diamonds back-to-back.


The diamonds are wingdings letter "s".


So the rule would have to basically just return the field with the letter s changed to wingdings, that way I can just choose to supress when empty.


Does that make sense?

Link to comment
Share on other sites

There's probably a simpler way to do this but I had something similar already done in a template awhile back. It also has a function to put the dots in the phone numbers.


Feel free to pick this apart or post something more efficient.


function fixnum(nval)
   var n = nval.replace(/\D/g,"");
   var sp = ".";
   var ac = "602"; //use for 7 digit phone

   if (n.substring(0,1) == "1")
       n = n.substring(1);

   if (n.length < 8)
       n = ac + n;

   return n.substring(0,3) + sp + n.substring(3,6) + sp +n.substring(6,10);

var f_ph1 = Field("ph1");
var f_ph2 = Field("ph2");
var f_ph3 = Field("ph3");
var ph1 = "";
var ph2 = "";
var ph3 = "";
var bul1 = "";
var bul2 = "";
var bul = '<span font="Wingdings">' + " s " + '</span>';

if (f_ph1.length > 0)
   ph1 = "Dir: " + fixnum(f_ph1);

if (f_ph2.length > 0)
   ph2 = "Tel: " + fixnum(f_ph2);

if (f_ph3.length > 0)
   ph3 = "Fax: " + fixnum(f_ph3);

if (ph1.length > 0 && (ph2.length > 0 || ph3.length > 0))
   bul1 = bul;

if (ph2.length > 0 && ph3.length > 0)
   bul2 = bul;

return ph1 + bul1 + ph2 + bul2 + ph3;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...