Skip to content

Instantly share code, notes, and snippets.

@hicglobalsolutions
Created April 25, 2024 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hicglobalsolutions/a4955653d801c447961cbec1d1118ccb to your computer and use it in GitHub Desktop.
Save hicglobalsolutions/a4955653d801c447961cbec1d1118ccb to your computer and use it in GitHub Desktop.
swap out the code, and let the magic happen. This is where your Aura Component taps into JsBarcode's enchanting powers.
({
generateBarcode : function(component, event, helper) {
// Reset previous barcode output
component.set("v.barcodeGenerated", false);
// Get the barcode value and selected format
var barcodeValue = component.get("v.barcodeValue");
var selectedFormat = component.get("v.selectedFormat");
// Call helper method to generate the barcode
var result = helper.generateBarcode(component, barcodeValue, selectedFormat);
// Check if barcode generation was successful
if (!result.success) {
// Set error message if barcode generation failed
component.set("v.errorMessage", result.errorMessage);
} else {
// Clear any previous error messages
component.set("v.errorMessage", "");
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment