Here's the code - I moved the Update Record behavior down, still no dice
I thought this might be it as well, but I moved the behavior down and it still doesn't work. Keep in mind this form works fine if I trigger on button press, but no if I change trigger to Before Pageload. Is there some other code above that's triggering?
I stripped out everything from the form but the most important detail for this page of the form.
Code
<?php require_once('../../Connections/cnArtsalaLcl.php'); ?>
<?php require_once( "../../webassist/security_assist/helper_php.php" ); ?>
<?php require_once("../../webassist/database_management/wa_appbuilder_php.php"); ?>
<?php
if (!WA_Auth_RulePasses("ArtistLoggedIn")){
WA_Auth_RestrictAccess("../login.php");
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_rsArt = "-1";
if (isset($_SESSION['idNewArt'])) {
$colname_rsArt = $_SESSION['idNewArt'];
}
mysql_select_db($database_cnArtsalaLcl, $cnArtsalaLcl);
$query_rsArt = sprintf("SELECT idArt, Art_idArtist, Art_InvNum, artists.idArtists, artists.artist_invnumcurrent FROM art, artists WHERE idArt = %s AND Art_idArtist=artists.idArtists", GetSQLValueString($colname_rsArt, "int"));
$rsArt = mysql_query($query_rsArt, $cnArtsalaLcl) or die(mysql_error());
$row_rsArt = mysql_fetch_assoc($rsArt);
$totalRows_rsArt = mysql_num_rows($rsArt);?>
<!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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<label for="CurrInvNum"></label>
<input name="CurrInvNum" type="text" id="CurrInvNum" value="<?php echo $row_rsArt['Art_InvNum']+1; ?>" />
<input type="submit" name="submit" id="submit" value="Submit" />
</form>
</body>
<?php
// WA DataAssist Update
if ("" == "") // Trigger
{
$WA_connection = $cnArtsalaLcl;
$WA_table = "artists";
$WA_redirectURL = "../index.php";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_indexField = "idArtists";
$WA_fieldNamesStr = "artist_invnumcurrent";
$WA_fieldValuesStr = "".((isset($_POST["CurrInvNum"]))?$_POST["CurrInvNum"]:"") ."";
$WA_columnTypesStr = "none,none,NULL";
$WA_comparisonStr = "=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode($WA_AB_Split, $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_where_fieldValuesStr = "".$row_rsArt['idArtists'] ."";
$WA_where_columnTypesStr = "none,none,NULL";
$WA_where_comparisonStr = "=";
$WA_where_fieldNames = explode("|", $WA_indexField);
$WA_where_fieldValues = explode($WA_AB_Split, $WA_where_fieldValuesStr);
$WA_where_columns = explode("|", $WA_where_columnTypesStr);
$WA_where_comparisons = explode("|", $WA_where_comparisonStr);
$WA_connectionDB = $database_cnArtsalaLcl;
mysql_select_db($WA_connectionDB, $WA_connection);
@session_start();
$updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues, $WA_where_comparisons );
$WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
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);
}
}
?>
</html>
<?php
mysql_free_result($rsArt);
?>