Hi @infofinal
I hope you’re well today!
If you have phone field validation type set to “National” or “International” the number of characters may be “flexible” but it will only accept number if it follows formats allowed for given country (so if e.g. contry has 10 and 11 digits numbers – both will be accepted; if country has only 11 digits numbers – only such numbers will be accepted and not shorter).
If you have validation set to “character limit” then there’s only upper limit – up to X characters.
In both cases, however, you can use this additional code on site to set minimum limit:
<?php
function min_forminator_input_chars() {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#forminator-module-123 input[name="phone-1"]').attr('minlength', '5');
});
</script>
<?php
}
add_action( 'wp_footer', 'min_forminator_input_chars', 99 );
To add it:
– create an empty file with a .php extension (e.g. “forminator-min-digit-limit.php”)
– copy and paste code into it
– in this line
$('#forminator-module-123 input[name="phone-1"]').attr('minlength', '5');
make following changes
a) replace number 123 with your form ID; form ID is the number you see in form’s shortocde
b) replace phone-1 with your phone field ID (if different)
c) replace number 5 with your minimum limit
– then save the file and upload it (using FTP, cPanel’s “File Manager” or similar way) to the “/wp-content/mu-plugins” folder of your site.
That’s it. You may need to clear cache on site/server but it should then work out of the box, like this:
https://app.screencast.com/eh1C3DD9kjZO3
Best regards,
Adam