I'm facing the problem with form validation. I wrote following code into my template:
Code: Select all
<?php
defined('_JEXEC') or die('Restricted access');
JHTMLBehavior::formvalidation();
?>
<script type="text/javascript" language="javascript">
function myValidate(f){
if(document.formvalidator.isValid(f)){
return true;
}else{
alert('Fill out input name.')
return false;
}
return false;
}
</script>
<form action="index.php" method="post" name="adminForm" id="adminForm" class="form-validate" onsubmit="return myValidate(this);">
....
<input class="required text_area" type="text" name="inputName" id="albumName" size="32" maxlength="250" value="" />
...
Now everything works correctly. I do not fill out inputName input an alert message occurs, but despite that, the form is submited after I click ok.
Can anybody tell me why?
Thanx