# WIX QR Code Generation - Clarification

**URL:** <https://forum.wixstudio.com/t/wix-qr-code-generation-clarification/53531>\
**Category:** Ask the community\
**Tags:** technical-talk, design, code\
**Created:** [November 3, 2023, 6:03pm UTC](https://forum.wixstudio.com/t/wix-qr-code-generation-clarification/53531 "2023-11-03T18:03:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![PB\_JAM\_Platform](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pb_jam_platform/32/33355_2.png) [@PB\_JAM\_Platform](https://forum.wixstudio.com/u/PB_JAM_Platform)\
**Post date:** [November 3, 2023, 6:03pm UTC](https://forum.wixstudio.com/t/wix-qr-code-generation-clarification/53531/1 "2023-11-03T18:03:48Z")

</div>

Thank you WIX for providing a QR code generator using Velo and the npm package! I tried out the code and was getting a WIX SDK error for the wrong src assignment (had to be a string). After trying multiple things, this is what worked for me: The src string has to be within double quote marks. So, the [WIX example code](https://www.wix.com/velo/example/QR-Code-Generator) should be updated as below:

**Original Code:**

```js
import { generateQRcode } from 'backend/qrCode.jsw';
$w.onReady(() => {
	$w('#generateButton').onClick(async () => {
		const toGenerate = $w('#qrInput').value;
		const qr = await generateQRcode(toGenerate);
		$w('#qrVector').src = qr;
	});
});

```

**Modified Code:**

```js
import { generateQRcode } from 'backend/qrCode.jsw';
$w.onReady(function () {
	$w('#generateButton').onClick(async () => {
		const toGenerate = "\"+$w('#qrInput').value+"\";
		const qr = await generateQRcode(toGenerate);
		$w('#qrVector').src = qr;
	});
});

```

PS: Whenever I type the backslash character, it is ignored in the final post, so replacing it with verbal description… please replace with the backslash… 😛

---

<div class="post-metadata">

**Author:** ![anthony](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/anthony/32/79536_2.png) [@anthony](https://forum.wixstudio.com/u/anthony)\
**Post date:** [November 3, 2023, 8:17pm UTC](https://forum.wixstudio.com/t/wix-qr-code-generation-clarification/53531/2 "2023-11-03T20:17:36Z")

</div>

If your `$w('#qrInput').value` has to be a string then`$w('#qrInput').value.toString()` might work as well.

---

<div class="post-metadata">

**Author:** ![PB\_JAM\_Platform](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pb_jam_platform/32/33355_2.png) [@PB\_JAM\_Platform](https://forum.wixstudio.com/u/PB_JAM_Platform)\
**Post date:** [November 6, 2023, 9:30pm UTC](https://forum.wixstudio.com/t/wix-qr-code-generation-clarification/53531/3 "2023-11-06T21:30:20Z")

</div>

@anthony, good point! I also found that as generateQRcode is a method with promise, ideally, I need to make sure that the promise value is returned before assigning it to the src parameter.

I am using this feature to create QR codes as verification codes specific to a transaction/record and here is what worked for me finally.

```
                wixData.insert("CREDENTIALS",CertInsert).then((qrgen)=>{
                    $w("#textBox243").value = "\""+"https://www.mysite.com/verification/"+qrgen._id+"\"";
                    const toGenerate=$w("#textBox243").value
                    generateQRcode(toGenerate).then((GenQR)=>{const qr=GenQR.toString();$w("#vectorImage82").src=qr})
                })

```

---

<div class="post-metadata">

**Author:** ![PB\_JAM\_Platform](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pb_jam_platform/32/33355_2.png) [@PB\_JAM\_Platform](https://forum.wixstudio.com/u/PB_JAM_Platform)\
**Post date:** [April 26, 2024, 12:20am UTC](https://forum.wixstudio.com/t/wix-qr-code-generation-clarification/53531/4 "2024-04-26T00:20:53Z")

</div>

Alright, folks! The above code solution works fine on standard pages, but it doesn’t work on dynamic pages. What might I be missing?

---

<div class="post-metadata">

**Author:** ![PB\_JAM\_Platform](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pb_jam_platform/32/33355_2.png) [@PB\_JAM\_Platform](https://forum.wixstudio.com/u/PB_JAM_Platform)\
**Post date:** [May 8, 2024, 10:12pm UTC](https://forum.wixstudio.com/t/wix-qr-code-generation-clarification/53531/5 "2024-05-08T22:12:07Z")

</div>

^^bump^^

So has anybody an idea of what is the difference between static page and dynamic page when it comes to generating QR codes?

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [May 9, 2024, 10:29am UTC](https://forum.wixstudio.com/t/wix-qr-code-generation-clarification/53531/6 "2024-05-09T10:29:42Z")

</div>

**Counter-question.**

What is the exact difference, between → ordinary-pages ← and → dynamic pages ← ???

---

<div class="post-metadata">

**Author:** ![PB\_JAM\_Platform](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pb_jam_platform/32/33355_2.png) [@PB\_JAM\_Platform](https://forum.wixstudio.com/u/PB_JAM_Platform)\
**Post date:** [May 14, 2024, 3:12pm UTC](https://forum.wixstudio.com/t/wix-qr-code-generation-clarification/53531/7 "2024-05-14T15:12:51Z")

</div>

@CODE-NINJA Dynamic pages are linked to a collection, while ordinary pages are not.
