Aug 10th, 2011, 10:44 AM
Hello,
Because IPAD is not for flash I have to make a multiple form in html/php. I have made one in flash: http://www.villacosta.nl/huis_kopen_span...akket.html.
Now I started with the example: http://www.benjaminkeen.com/software/rsv...php?page=7
When I follow the instructions I get errors:
When I set:if (errorInfo.length == 0); return false;,
the validation works fine but when I submit it doesn't go to the neaxt page. When I set:if (errorInfo.length == 0); return true;,
there's no validation but then I can go to the next page.
I hope someone has a solution. Here's the code:
<?php
require_once("/home/vhosts/villacosta.nl/httpdocs/cms/global/api/api.php");
$fields = ft_api_init_form_page("", "test");
$params = array(
"submit_button" => "continue",
"next_page" => "stap7.php",
"form_data" => $_POST
);
ft_api_process_form($params);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Stap 1</title>
<meta name="keywords" content="RSV,Really Simple Validation,form validation,validation,Benjamin Keen,Ben Keen">
<script type="text/javascript" src="rsv.js"></script>
<link rel="stylesheet" type="text/css" href="styles.css">
<script type="text/javascript">
rsv.displayType = "display-html";
rsv.customErrorHandler = myCustomErrorDisplayFunction;
var rules = [];
rules.push("required,naw1,Aanhef?");
rules.push("required,naw2,Please enter your first name.");
rules.push("required,naw3,Please enter your last name.");
rules.push("required,naw10,Please enter your email address.");
rules.push("valid_email,naw10,Please enter a valid email address.");
function myCustomErrorDisplayFunction(f, errorInfo)
{
// disabled all errors by default
for (var i=0; i<rules.length; i++)
{
var parts = rules[i].split(",");
var fieldName = parts[1];
document.getElementById(fieldName + "_label").style.color = "#000000";
document.getElementById(fieldName + "_error").style.display = "none";
}
for (var i=0; i<errorInfo.length; i++)
{
var fieldName;
// radio button
if (errorInfo[i][0].type == undefined)
fieldName = errorInfo[i][0][0].name;
else
fieldName = errorInfo[i][0].name;
// display the error
document.getElementById(fieldName + "_label").style.color = "#cc0000";
document.getElementById(fieldName + "_error").style.display = "block";
document.getElementById(fieldName + "_error").innerHTML = errorInfo[i][1];
}
if (errorInfo.length == 0);
return false;
}
</script>
</head>
<body>
<table class="table_1" cellpadding="2" cellspacing="1" width="960">
<tr>
<td colspan="3" class="table_1_bg">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="table_1_title">CONTACT INFO</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="960">
<form action="<?=$_SERVER['PHP_SELF']?>" method="post" onSubmit="return rsv.validate(this, rules)">
<a name="contact_info"></a>
<table cellpadding="0" cellspacing="1" width="100%">
<tr>
<td valign="top" class="red" width="10">*</td>
<th align="left" valign="top" id="naw1_label" width="130">Aanhef</th>
<td class="answer" width="300">
<input type="radio" id="ms1" name="naw1" value="heer" <?php if (@$fields['naw1'] == "yes") echo "checked"; ?>/><label for="ms1">heer</label><br/>
<input type="radio" id="ms2" name="naw1" value="mevrouw" <?php if (@$fields['naw1'] == "yes") echo "checked"; ?>/><label for="ms2">mevrouw</label>
</td>
<td valign="top">
<span id="naw1_error" class="custom_error"></span>
</td>
</tr>
<tr>
<td valign="top" class="red">*</td>
<th align="left" id="naw2_label">Voornaam</th>
<td class="answer">
<input type="text" name="naw2" value="<?=@$fields['naw2']?>" size="50"/>
</td>
<td>
<span id="naw2_error" class="custom_error"></span>
</td>
</tr>
<tr>
<td class="red">*</td>
<th align="left" id="naw3_label">Achternaam:</th>
<td class="answer">
<input type="text" name="naw3" value="<?=@$fields['naw3']?>" size="50"/>
</td>
<td>
<span id="naw3_error" class="custom_error"></span>
</td>
</tr>
<tr>
<td class="red">*</td>
<th align="left" id="naw10_label">Email</th>
<td class="answer">
<input type="text" name="naw10" value="<?=@$fields['naw10']?>" size="50"/>
</td>
<td>
<span id="naw10_error" class="custom_error"></span>
</td>
</tr>
</table>
<p>
<input type="submit" name="continue" value="Continue" /></p>
</form>
</td>
</tr>
</table>
</body>
</html>
Because IPAD is not for flash I have to make a multiple form in html/php. I have made one in flash: http://www.villacosta.nl/huis_kopen_span...akket.html.
Now I started with the example: http://www.benjaminkeen.com/software/rsv...php?page=7
When I follow the instructions I get errors:
When I set:if (errorInfo.length == 0); return false;,
the validation works fine but when I submit it doesn't go to the neaxt page. When I set:if (errorInfo.length == 0); return true;,
there's no validation but then I can go to the next page.
I hope someone has a solution. Here's the code:
<?php
require_once("/home/vhosts/villacosta.nl/httpdocs/cms/global/api/api.php");
$fields = ft_api_init_form_page("", "test");
$params = array(
"submit_button" => "continue",
"next_page" => "stap7.php",
"form_data" => $_POST
);
ft_api_process_form($params);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Stap 1</title>
<meta name="keywords" content="RSV,Really Simple Validation,form validation,validation,Benjamin Keen,Ben Keen">
<script type="text/javascript" src="rsv.js"></script>
<link rel="stylesheet" type="text/css" href="styles.css">
<script type="text/javascript">
rsv.displayType = "display-html";
rsv.customErrorHandler = myCustomErrorDisplayFunction;
var rules = [];
rules.push("required,naw1,Aanhef?");
rules.push("required,naw2,Please enter your first name.");
rules.push("required,naw3,Please enter your last name.");
rules.push("required,naw10,Please enter your email address.");
rules.push("valid_email,naw10,Please enter a valid email address.");
function myCustomErrorDisplayFunction(f, errorInfo)
{
// disabled all errors by default
for (var i=0; i<rules.length; i++)
{
var parts = rules[i].split(",");
var fieldName = parts[1];
document.getElementById(fieldName + "_label").style.color = "#000000";
document.getElementById(fieldName + "_error").style.display = "none";
}
for (var i=0; i<errorInfo.length; i++)
{
var fieldName;
// radio button
if (errorInfo[i][0].type == undefined)
fieldName = errorInfo[i][0][0].name;
else
fieldName = errorInfo[i][0].name;
// display the error
document.getElementById(fieldName + "_label").style.color = "#cc0000";
document.getElementById(fieldName + "_error").style.display = "block";
document.getElementById(fieldName + "_error").innerHTML = errorInfo[i][1];
}
if (errorInfo.length == 0);
return false;
}
</script>
</head>
<body>
<table class="table_1" cellpadding="2" cellspacing="1" width="960">
<tr>
<td colspan="3" class="table_1_bg">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="table_1_title">CONTACT INFO</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="960">
<form action="<?=$_SERVER['PHP_SELF']?>" method="post" onSubmit="return rsv.validate(this, rules)">
<a name="contact_info"></a>
<table cellpadding="0" cellspacing="1" width="100%">
<tr>
<td valign="top" class="red" width="10">*</td>
<th align="left" valign="top" id="naw1_label" width="130">Aanhef</th>
<td class="answer" width="300">
<input type="radio" id="ms1" name="naw1" value="heer" <?php if (@$fields['naw1'] == "yes") echo "checked"; ?>/><label for="ms1">heer</label><br/>
<input type="radio" id="ms2" name="naw1" value="mevrouw" <?php if (@$fields['naw1'] == "yes") echo "checked"; ?>/><label for="ms2">mevrouw</label>
</td>
<td valign="top">
<span id="naw1_error" class="custom_error"></span>
</td>
</tr>
<tr>
<td valign="top" class="red">*</td>
<th align="left" id="naw2_label">Voornaam</th>
<td class="answer">
<input type="text" name="naw2" value="<?=@$fields['naw2']?>" size="50"/>
</td>
<td>
<span id="naw2_error" class="custom_error"></span>
</td>
</tr>
<tr>
<td class="red">*</td>
<th align="left" id="naw3_label">Achternaam:</th>
<td class="answer">
<input type="text" name="naw3" value="<?=@$fields['naw3']?>" size="50"/>
</td>
<td>
<span id="naw3_error" class="custom_error"></span>
</td>
</tr>
<tr>
<td class="red">*</td>
<th align="left" id="naw10_label">Email</th>
<td class="answer">
<input type="text" name="naw10" value="<?=@$fields['naw10']?>" size="50"/>
</td>
<td>
<span id="naw10_error" class="custom_error"></span>
</td>
</tr>
</table>
<p>
<input type="submit" name="continue" value="Continue" /></p>
</form>
</td>
</tr>
</table>
</body>
</html>