javascript - onsubmit validation not working of 2 forms -


i have 2 forms in 1 div & using hide & show & have same validation both forms issue onsubmit validation not working in 1 form in other form validation working.

function validateexpiry() {      var today, someday;      var exmonth=document.getelementbyid("exmonth").value;      var exyear=document.getelementbyid("exyear").value;      today = new date();      someday = new date();      someday.setfullyear(exyear, exmonth, 1);      if (someday < today) {          document.getelementbyid('invalidexpiry').innerhtml="invalid expiry date";          return false;      }      return true;  }      function validate_cvv(cvv) {      var myre = /^[0-9]{3,4}$/;      if(cvv.value.match(myre)) {          return true;      } else {          document.getelementbyid('usernameerror').innerhtml="invalid cvv";          return false;      }  } 
<form name="card" id="card" onsubmit="return validateexpiry(document.card.month,year)&& validate_cvv(document.card.cvv);">            <form name="debitcard" id="debitcard" onsubmit="return validateexpiry(document.debitcard.month,year)&& validate_cvv(document.debitcard.cvv);">


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -