Johan W.
Johan W.

Reputation: 127

Add IBAN check to widget validation

For an employee questionnaire I would like to add an IBAN check to a textbox widget. Is it possible to add a library like https://github.com/arhs/iban.js as an external resource in App Maker? How do I have to implement a validation method once the library has been added.

Upvotes: 1

Views: 286

Answers (2)

Ian Hyzy
Ian Hyzy

Reputation: 532

You may also consider using Regex to validate the IBAN - you won't need to worry about pulling in external JS then. This answer may be useful. With this regex, you can validate the string server side, which is more secure. This link has more information on validating RegEx in Javascript.

Upvotes: 0

Pavel Shkleinik
Pavel Shkleinik

Reputation: 6347

You can easily add any external library. If library is available via CDN (Content Delivery Network) you can just add URL in Application Settings -> External Resources -> JavaScript URLs otherwise you can upload the js file as app resource (Settings -> Resources) and use resource's URL instead.

The library will help you to validate input on client:

// onValidate event of input widget:
if (!IBAN.isValid(newValue)) {
  return 'Please, provide valid account number';
}

But it will not help you with server side validation... So, end user can in theory compromise your system through dev console. You can try to copy/paste library's code to server script and make extra validation in onBeforeCreate and onBeforeSave model's events but most likely it will require some additional tweaks.

Upvotes: 1

Related Questions