MarcomCentral (PTI) and FusionPro User Communities

MarcomCentral (PTI) and FusionPro User Communities (http://forums.pti.com/index.php)
-   Issues, Questions, Etc. (http://forums.pti.com/forumdisplay.php?f=40)
-   -   Issue with Ampersand in URL for QR Code (http://forums.pti.com/showthread.php?t=5387)

StacyZ August 1st, 2019 12:54 PM

Issue with Ampersand in URL for QR Code
 
I had originally posted this in the barcode section.

Hello,

I'm having an issue dealing with a QR Code where there are ampersands in the destination URL.

I'll paste the code I have below but please note that the first part of the URL will be changed here due to security. That isn't the area I'm having trouble with however, the problem is with the last section that reads ("&DMC-DIRECTMAIL&mid=H3W&version=A")

QR Code Rule:

var dataforbarcode = ("http://order.com/H3W/Main-A.asp?No=" + encodeURIComponent (Left(Field("CODE"), 8) + ("&DMC-DIRECTMAIL&mid=H3W&version=A")));
var dmbarcodeobj = new QRBarcode;
dmbarcodeobj.encodingmode = (Left(Field("CODE"), 8));
dmbarcodeobj.pointSize = 3.5;

return dmbarcodeobj.Make(dataforbarcode);



This code returns the correct page without the customer information. I need to get the customer information to show.

Thank you

Dan Korn August 1st, 2019 04:45 PM

Re: Issue with Ampersand in URL for QR Code
 
Try this instead:
Code:

var dataforbarcode = "http://order.com/H3W/Main-A.asp?No=" +
    encodeURIComponent (Left(Field("CODE"), 8)) +
    "&DMC-DIRECTMAIL&mid=H3W&version=A";

You don't need to URL encode the part of the URL that's already in the correct format.

Also, get rid of this line:
Code:

dmbarcodeobj.encodingmode = (Left(Field("CODE"), 8));
The default encoding mode should work fine.

StacyZ August 1st, 2019 05:38 PM

Re: Issue with Ampersand in URL for QR Code
 
Thank you Dan!


All times are GMT -7. The time now is 06:12 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.