registerUser()
関数を呼び出すにはどうすればよいですか
if (formvalidate()==true); // i am trying here
registerUser(); // shall be called if formvalidate() is true
私が使用しているコードは次のとおりです。
<?PHP
include("functions.php");
if(isset($_POST['Submit1']))
{
?>
<script type="text/javascript">
if(formvalidate()==true);//i am trying here
registerUser();this will do if formvalidat return true
helloworld();
<?php }; ?>
<script type="text/javascript">
function formvalidate()
{
if( document.Form.first_name.value == "" )
{
alert( "Please insert your name." );
document.Form.first_name.focus() ;
return false;
}
if( document.Form.last_name.value == "" )
{
alert( "Please insert your last name." );
document.Form.last_name.focus() ;
return false;
}
if( document.Form.password.value == "" )
{
alert( "Please insert your password." );
document.Form.password.focus() ;
return false;
}
if( document.Form.username.value == "" )
{
alert( "Please insert your user name(display name) ." );
document.Form.username.focus() ;
return false;
}
if ( ( Form.gender[0].checked == false ) && ( Form.gender[1].checked == false ) )
{
alert( "Please select your gender." );
document.Form.gender.focus() ;
return false;
}
if( document.Form.birthdate_year.value == "" )
{
alert( "Please insert your birthyear." );
document.Form.birthdate_year.focus() ;
return false;
}
if( document.Form.birthdate_day.value == "" )
{
alert( "Please insert your birthDAY." );
document.Form.birthdate_day.focus() ;
return false;
}
if( document.Form.birthdate_month.value == "" )
{
alert( "Please insert your birthmonth." );
document.Form.birthdate_month.focus() ;
return false;
}
//gender $_POST['birthdate_year']."-".$_POST['birthdate_month']."-".$_POST['birthdate_day']
if( !validateEmail())
{
alert( "Please insert your Email address." );
document.Form.email.focus() ;
return false;
}
if( document.Form.zip.value == "" ||isNaN( document.Form.Pin.value ) )
{
alert( "Please insert the pin code." );
document.Form.zip.focus() ;
return false;
}
if( document.Form.countries.value == "" )
{
alert( "Please select your country!" );
return false;
}
return( true );
}
function validateEmail()
{
var emailID = document.Form.email.value;
atpos = emailID.indexOf("@");
dotpos = emailID.lastIndexOf(".");
if (atpos < 1 || ( dotpos - atpos < 2 ))
{
return false;
}
return( true );
}
</script>