• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Generate/show a QR Code image

Generate/show a QR Code image 4 years 6 months ago #40646

  • info6625
  • info6625's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
Hi,

I try to (dynamically) show a picture of a QR code, the url of which I generate when the amount field changes.

Example:
<img src="https://epc-qr.eu/?bname=MyName%20&iban=MyIban&euro=10&info=MyDescription&bic=MyBIC">

However, I tried all methods described in this forum, but I can't get it to work. I can generate the url dynamically when the amount changes, but I cannot get the form to display it.
I tried a hidden field, a text field, I tried changing the layout (as with uploaded pictures), all to no avail.

Any help would be appreciated! - Han

Edit: I solved this using jQuery in the JS section of the form, really easy. The 'Number' field is monitored by jQuery .change, the 'Amount' filed is filled with a calculated (read-only) textfield in the form. The field where I display the QR code in is a free text html-field containing the following content:
<a id="QRlink" class="uk-button uk-button modal" style="width: 100%;" target="_self" href="https://epc-qr.eu/?bname=MyName&iban=MyIban&euro=urlAmount&info=MyInfo, number of items:%20urlItems&bic=MyBic">Show the QR Code</a>
<script type="text/javascript">
jQuery(document).ready(function($) {
   // On change of the number field:
   $("#Number").change(function(){
   var myAmount = $('#Amount').attr('value');         // Get the amount
   var myNumber =  $('#Number').attr('value');       // Get the no. of items
   var myUrl = 'https://epc-qr.eu/?bname=MyName&iban=MyIban&euro=urlAmount&info=MyInfo, number of items:%20urlItems&bic=MyBic';                                       // Set the url with placeholders
   myUrl =myUrl.replace("urlAmount", myAmount);   // replace amount
   myUrl =myUrl.replace("urlItems", myNumber);     // replace no. of items
   $('#QRlink').attr('href', myUrl);                  // update the href of the QRlink form field
  });
});
</script>

I also changed that the image is not generated each time the page is visited but is showed in a modal, only on the press of a button (id = 'QrLink') to avoid unnecessary call and overload of the epc-qr.eu server (there is a limit on the number of calls per day).
Last Edit: 4 years 6 months ago by info6625. Reason: Clarification of use button vs direct show of QR image
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!