Thanks for the contribution, solution #1 looks perfectly good to me but it doesn't work the way I want it to work.
I've been trying the code, rewriting it a little, etc. but it keeps doing what it wants.
Sometimes it works, sometimes it doesn't. (Programming languages just don't come natural to me).
What I want it to do is this:
- create a QR code with a default error message in the QR as defined in
var error whenever the input
-is less than 25 characters in length
-has any non-BASE58 characters in it
else, create the QR for a valid Bitcoin (or any altcoin address) using create_qrcode(text).
Make me a quote for payment along with the solution (but stay within reason, please).
Here's the code in qrconf.js after trying out different things (the original one is still up on the site):
var draw_qrcode = function(text, typeNumber, errorCorrectLevel) {
document.write(create_qrcode(text, typeNumber, errorCorrectLevel) );
};
var error = "Try Again!";
var text = document.forms[0].elements['msg'].value;
var create_qrcode = function(text, typeNumber, errorCorrectLevel, table) {
var qr = qrcode(typeNumber || 4, errorCorrectLevel || 'H');
qr.addData(text);
qr.make();
// return qr.createTableTag();
return qr.createImgTag();
};
var update_qrcode = function() {
var text = document.forms[0].elements['msg'].value;
if (text.length < 25) {
document.getElementById('qr').innerHTML = create_qrcode(error);
}
if(text.match(/[^123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+/g)) {
document.getElementById('qr').innerHTML = create_qrcode(error);
}
else {
document.getElementById('qr').innerHTML = create_qrcode(text);
};
};
I don't get why it doesn't work.. what am I doing wrong?
Thanks in advance