board logo
Posted by: WUICTeam - Monday, November 9, 2026 9:02:07 AM
[b]Update:[/b] [c]mc_validation_type[/c] now supports [c]number[/c] and [c]date[/c] as well, and the documentation lists the supported types. Fixed in [url=https://wuic-framework.com/downloads/release-notes#v1.8.2]WUIC Framework 1.8.2[/url]. [i]The original answer below describes versions before 1.8.2.[/i] [b]Question[/b] I set [c]mc_validation_type[/c] to [c]number[/c] (or [c]date[/c]) on a column and now the form rejects every value I type. What am I doing wrong? [b]Answer[/b] Nothing in your data: typed validation only recognises three types, [c]email[/c], [c]url[/c] and [c]creditcard[/c] (Luhn check). Any other value, [c]number[/c] and [c]date[/c] included, has no matching check, so the rule fails for every non-empty value and the client also raises a metadata diagnostic about the unknown type. Note that the documentation says "email/url/number/date depending on the build"; in the current code only those three are handled. For numbers and dates use one of these instead: [list] [*][c]mc_validation_pattern[/c] with an anchored regex, for example [c]^-?\d+([.,]\d+)?$[/c]. The string goes straight into a JavaScript [c]RegExp[/c], so without [c]^[/c] and [c]$[/c] a partial match passes. [*][c]mc_validation_custom_callback[/c] for anything a regex cannot express (ranges, dependencies on other fields). [/list] [b]Custom callback example[/b] [code] const raw = record[field.mc_nome_colonna].value; if (raw !== '' && raw != null && Number.isNaN(Number(raw))) { vr.message = 'Enter a valid number'; return false; } return true; [/code] [b]Things to keep in mind[/b] [list] [*]Values in [c]record[/c] are BehaviorSubjects, so read them with [c].value[/c]. [*]The callback result is accepted only when it is exactly [c]true[/c]. Returning [c]1[/c], a string or nothing at all blocks the save. [*]Pattern, type and length rules are skipped when an optional field is empty; mandatory fields need [c]mc_validation_required[/c]. The custom callback, instead, runs on empty values too. [*]Rules are built only for editable columns that have validation enabled ([c]mc_validation_has[/c]). [/list] [url=https://wuic-framework.com/docs/validations]Documentation: Validations[/url]