Miko. eCommerce Template

Mon. - Fri. 9 am - 5 pm Ask a Question
Remember me

How can I add more validations to text field and email field?

2 weeks 5 days ago #1

  • Coty's Avatar
  • Coty
  • Posts: 1
I have text field with type text, it is first name and last name. I want that ppl shoud not enter any number value in it.

also an email field validations need to handle space if i press space it should give error. as for now it accepts email from myname@mydomain . co m but it should pop up error msg that spaces are not allowed ?

where to add such validations?

2 weeks 4 days ago #2

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 16531
Thank you for contacting us

You need to add classes for fields (respectively) custom-name-validatio,custom-email-validation
and add JS code in the code editor
document.addEventListener('DOMContentLoaded', function(){
    jQuery('.custom-name-validation input').on('input', function(){
        let match = this.value.match(/\d+/);
        if (match) {
            this.value = this.value.replace(/\d+/, '');
    jQuery('.custom-email-validation input').on('input', function(){
        let match = this.value.match(/\s+/g);
        if (match) {
            this.value = this.value.replace(/\s+/, '');

Vyacheslav, Balbooa.com
Powered by Kunena Forum