how to make javascript validation onsubmit go first before onclick submit button

<form name="daftar" method="post" action="daftar.php" onsubmit="return checkscript()">

<input type="submit" name="Daftar" value="Daftar" id="submit" onClick="return tq()"/>

and my js:

function checkscript() {
if (document.daftar.terms.checked == false)
{ alert('Sila pastikan anda telah check ruangan persetujuan, untuk menandakan anda setuju dengan syarat-syarat kami.');
daftar.terms.focus();
return false ;
}
else return true;
}

function tq()
{
alert("Terima Kasih!");
}

Recommended Answers

<form name="daftar" method="post" action="daftar.php" onsubmit="return tq()">

<input type="submit" name="Daftar" value="Daftar" id="submit" onClick="return checkscript()"/>

perhaps

Jump to Post

All 2 Replies

<form name="daftar" method="post" action="daftar.php" onsubmit="return tq()">

<input type="submit" name="Daftar" value="Daftar" id="submit" onClick="return checkscript()"/>

perhaps

tq..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.