close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Why won't this validate? It keeps returning

Thread began 1/31/2010 7:47 pm by larry289409 | Last modified 2/04/2010 6:46 am by larry289409 | 2686 views | 5 replies

larry289409

Partial improvement

Originally Said By: Jason Byrnes
  One problem I can see is that the form action is set to go to the users_Detail.php page. the action should be left blank so that the form will post to itself. you will need to redo the validation show if behaviors, and choose the users_insert page as the validation page.  




Here's what I have now. The validation messages don't go away, and nothing shows up on the Details page. However, the values are kept after inserting, and if all values are correct, we are taken to the Details page.

<?php require_once("Connections/Premiere.php"); ?>
<?php require_once("WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php require_once("WA_ValidationToolkit/WAVT_Scripts_PHP.php"); ?>
<?php require_once("WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php"); ?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$WAFV_Redirect = "users_Insert.php";
$_SESSION['WAVT_usersInsert_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["UserFirstName"]))?$_POST["UserFirstName"]:"") . "",false,1);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["UserLastName"]))?$_POST["UserLastName"]:"") . "",false,2);
$WAFV_Errors .= WAValidateEM(((isset($_POST["UserEmail"]))?$_POST["UserEmail"]:"") . "",true,3);
$WAFV_Errors .= WAValidatePN(((isset($_POST["UserPhone"]))?$_POST["UserPhone"]:"") . "",true,false,false,4);
$WAFV_Errors .= WAValidatePN(((isset($_POST["UserPhoneM"]))?$_POST["UserPhoneM"]:"") . "",true,false,false,5);
$WAFV_Errors .= WAValidateAN(((isset($_POST["JobType"]))?$_POST["JobType"]:"") . "",true,true,true,true,"",true,6);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"usersInsert");
}
}
?>
<?php
// WA Application Builder Insert
if (isset($_POST["Insert_x"])) // Trigger
{
$WA_connection = $Premiere;
$WA_table = "users";
$WA_sessionName = "WADA_Insert_users";
$WA_redirectURL = "/users_Detail.php";
$WA_keepQueryString = false;
$WA_indexField = "UserID";
$WA_fieldNamesStr = "UserEmail|UserPassword|UserFirstName|UserLastName|UserCity|UserState|UserZip|UserEmailVerified|UserRegistrationDate|UserVerificationCode|UserIP|UserPhone|UserPhoneM|TimeToCall|UserFax|UserCountry|JobType|JobNotes|UserAddress|UserAddress2";
$WA_fieldValuesStr = "".((isset($_POST["UserEmail"]))?$_POST["UserEmail"]:"") ."" . "|" . "".((isset($_POST["UserPassword"]))?$_POST["UserPassword"]:"") ."" . "|" . "".((isset($_POST["UserFirstName"]))?$_POST["UserFirstName"]:"") ."" . "|" . "".((isset($_POST["UserLastName"]))?$_POST["UserLastName"]:"") ."" . "|" . "".((isset($_POST["UserCity"]))?$_POST["UserCity"]:"") ."" . "|" . "".((isset($_POST["UserState"]))?$_POST["UserState"]:"") ."" . "|" . "".((isset($_POST["UserZip"]))?$_POST["UserZip"]:"") ."" . "|" . "".((isset($_POST["UserEmailVerified"]))?$_POST["UserEmailVerified"]:"") ."" . "|" . "".((isset($_POST["UserRegistrationDate"]))?$_POST["UserRegistrationDate"]:"") ."" . "|" . "".((isset($_POST["UserVerificationCode"]))?$_POST["UserVerificationCode"]:"") ."" . "|" . "".((isset($_POST["UserIP"]))?$_POST["UserIP"]:"") ."" . "|" . "".((isset($_POST["UserPhone"]))?$_POST["UserPhone"]:"") ."" . "|" . "".((isset($_POST["UserPhoneM"]))?$_POST["UserPhoneM"]:"") ."" . "|" . "".((isset($_POST["TimeToCall"]))?$_POST["TimeToCall"]:"") ."" . "|" . "".((isset($_POST["UserFax"]))?$_POST["UserFax"]:"") ."" . "|" . "".((isset($_POST["UserCountry"]))?$_POST["UserCountry"]:"") ."" . "|" . "".((isset($_POST["JobType"]))?$_POST["JobType"]:"") ."" . "|" . "".((isset($_POST["JobNotes"]))?$_POST["JobNotes"]:"") ."" . "|" . "".((isset($_POST["UserAddress"]))?$_POST["UserAddress"]:"") ."" . "|" . "".((isset($_POST["UserAddress2"]))?$_POST["UserAddress2"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|none,none,NULL|',none,NULL|',none,''|',none,''|',none,''|',none,''|none,none,NULL|',none,''|',none,''|none,none,NULL|',none,''|',none,''|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_Premiere;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$_SESSION[$WA_sessionName] = mysql_insert_id();
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert users</title>
<link href="/WA_DataAssist/styles/Arial.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
@import url("WA_DataAssist/styles/Refined_Pacifica.css");
-->
</style>
</head>

<body>

<div class="WADAInsertContainer">
<form action="" method="post" name="WADAInsertForm" id="WADAInsertForm">
<div class="WADAHeader">Insert Record</div>
<div class="WADAHorizLine"><img src="/WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<table width="686" border="0" cellpadding="0" cellspacing="0" class="WADADataTable"><tr><td class="WADANoResultsMessage"><table width="686" border="0" cellpadding="0" cellspacing="0" class="WADADataTable">
<tr>
<th class="WADADataTableHeader">&nbsp;</th>
<td colspan="2" align="center"class="WADANoResultsMessage"><?php
if (ValidatedField('usersInsert','usersInsert')) {
if ((strpos((",".ValidatedField("usersInsert","usersInsert").","), "," . "" . ",") !== false || "" == "")) {
if (!(false)) {
?>
Please review and fill in the items noted below
<?php //WAFV_Conditional users_Insert.php usersInsert( :)
}
}
}?></td>
</tr>
<tr>
<th width="202" class="WADADataTableHeader">First Name:</th>
<td width="276" class="WADADataTableCell"><input name="UserFirstName" type="text" id="UserFirstName" value="<?php echo(ValidatedField("usersInsert","UserFirstName")) ?>" size="32" /></td>
<td width="649"><?php
if (ValidatedField('usersInsert','usersInsert')) {
if ((strpos((",".ValidatedField("usersInsert","usersInsert").","), "," . "2" . ",") !== false || "2" == "")) {
if (!(false)) {
?>
We need your first name
<?php //WAFV_Conditional users_Insert.php usersInsert(2:)
}
}
}?>
<?php
if (ValidatedField('usersInsert','usersInsert')) {
if ((strpos((",".ValidatedField("usersInsert","usersInsert").","), "," . "") >= 0)) {
if (!((strpos((",".ValidatedField("usersInsert","usersInsert").","), "," . "1" . ",") !== false || "1" == ""))) {
?>
xxxxxx
<?php //WAFV_Conditional users_Insert.php usersInsert(:1)
}
}
}?></td>
</tr>
<tr>
<th class="WADADataTableHeader">Last Name:</th>
<td class="WADADataTableCell"><input type="text" name="UserLastName" id="UserLastName" value="<?php echo(ValidatedField("usersInsert","UserLastName")) ?>" size="32" /></td>
<td class="WADANoResultsMessage"><?php
if (ValidatedField('usersInsert','usersInsert')) {
if ((strpos((",".ValidatedField("usersInsert","usersInsert").","), "," . "2" . ",") !== false || "2" == "")) {
if (!(false)) {
?>
We need your last name
<?php //WAFV_Conditional users_Insert.php usersInsert(2:)
}
}
}?></td>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...