Is there a way to validate the values in the dialog box so that the user get feedback when entering the value?
For the EAN 13 barcode for example you can only enter 12 digits, so would like a check for \d{12} in the interface. I can of course have it in the JavaScript but that will not be seen when they enter the value.
How can we do that?
Hi Jan,
You can throw an exception in the script if the barcode value does not match, e.g. like this:
if( barcodeType == "EAN 13" && barcodeVar.length != 13)
{
throw "Barcod value must have 13 digits for EAN 13";
}
This will trigger a details view in the Ask at runtime dialog showing additional information including the exception message.
Once the error is fixed the script result is shown instead of the error message:
To get rid of the additional information you must the press CMD+I unfortunately.
For some reason the error message is not shown immediately after changing to EAN 13 but only once you select the Barcode information field. We will look into this…
Best regards,
Ulrich
Hi Jan,
Marc just made me aware of the fact that EAN 13 codes actually require only 12 digits as input. the 13th digit is a checksum calculated by the barcode engine.
So the code should actually be like
if( barcodeType == "EAN 13" && barcodeVar.length != 12)
{
throw "Barcode value must have 12 digits for EAN 13";
}
Yes I know that
, no problem

