Advanced Field Validations

Advanced Field Validations
0

Advanced phone number validation

As of version 3.1 MAINTENANCE 07, it is possible to do an advanced validation of phone numbers fields (typically in a preValidate hook.

Example:

var f = this.getFieldValue("myPhoneNumber");
f.setValue("myPhoneNumber", new PhoneNumTools("fr").getNationalNumber(f.getValue()));

NB: it is also possible to format as international format using getInternationalNumber instead of getNationalNumber

See this document for details

1 Like

IBAN Validation

As of version 5.0 it is possible to validate an IBAN.

Ex:

	@Override
	public List<String> postValidate() {
		List<String> msgs = new ArrayList<String>();
(...)
		// IBAN check
		ObjectField iban = getField("myIBANField");
		if (!Tool.checkIBAN(iban.getValue()))
			msgs.add(Message.formatError("MY_ERR_IBAN", iban.getValue(), iban.getName()));
(...)		
		return msgs;
	}