David Powers --- Regarding form validation with dreamweaver behaviors
I am in the chapter teaching about form validation with the Zend Framework. I have done the entire lesson with the lesson files and everything works perfectly...
but I went back to use the form valdation techniques for my own site and it is not working properly. In the book, Chapter 6 teaches how to create a user login and editing the database through the site. But in chapter seven the form validation does not build on top of this and therefore does not teach how to integrate the form validation with the registered user already set up.
I have user registration completly working on my site and everything runs fine. I am trying to add the form validation but it is all completly ignored. When I leave a field blank it simply takes me to another blank page that reads "Column 'first_name' cannot be null"
here is index.php code...
<?php require_once('Connections/CSSU_Write.php'); ?>
<?php require_once('Connections/CSSU_Read.php'); ?>
<?php require_once('script/user_registration.php');
?>
<?php
if (isset($_POST['password'])) {
$_POST['password'] = sha1($_POST['password']);
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;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO sign_up (first_name, family_name, user_email, password, gender, bday_month, bday_day, bday_year) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['first_name'], "text"),
GetSQLValueString($_POST['last_name'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['gender'], "text"),
GetSQLValueString($_POST['bday_month'], "text"),
GetSQLValueString($_POST['bday_day'], "text"),
GetSQLValueString($_POST['bday_year'], "text"));
mysql_select_db($database_CSSU_Write, $CSSU_Write);
$Result1 = mysql_query($insertSQL, $CSSU_Write) or die(mysql_error());
$insertGoTo = "login.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $insertGoTo));
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
if (isset($_POST['email'])) {
$loginUsername=$_POST['email'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "logoOutRedirect.php";
$MM_redirectLoginFailed = "logoOutRedirect.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_CSSU_Write, $CSSU_Write);
$LoginRS__query=sprintf("SELECT user_email, password FROM sign_up WHERE user_email=%s AND password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $CSSU_Write) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
header("Location: " . $MM_redirectLoginSuccess );
else {
header("Location: ". $MM_redirectLoginFailed );
?>
<!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>CSSU</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="container">
<div class="header">
<div class="logo">
<a href="index.php">
<h1/>
.CSSU { UNIVERSITY; }
</h1>
<h2>
<code><<code>!</code>-- Learn/Apply/Master --></code>
</h2>
</a>
</div>
<!-- end .header --></div>
<div class="headerBar">
<div id="nav">
<ul id="links">
<a href="#"><li>CSSU</li></a>
<a href="#"><li>Classes</li></a>
<a href="#"><li>Pricing</li></a>
<a href="#"><li>Degree</li></a>
</ul>
</div>
<form name="form2" method="POST" action="<?php echo $loginFormAction; ?>" class="form2">
<p>
<label for="email" id="email" class="loginLabel">Email:</label>
<input type="email" name="email" class="loginField" />
<label for="password" id="password" class="loginLabel">Password:</label>
<input type="password" name="password" class="loginField" />
<input type="submit" value="Log In" name="submit" class="submit login" />
</p>
</form>
</div>
<div class="container2">
<div class="sidebar1">
<h1>Sign Up</h1>
<h2>Earn an Official CSS Masters Certification!</h2>
<table>
<form name="form1" method="POST" action="<?php echo $editFormAction; ?>" class="form1">
<tr >
<td class="formLabel"><label for="firstName" id="firstNameLabel" >First Name:</label>
<span>
<?php
if ($_POST && isset($errors['first_name'])) {
echo $errors['first_name'];
?>
</span>
</td>
<td><input type="text" name="first_name" class="inputField" id="firstName" /></td>
</tr>
<tr>
<td class="formLabel"><label for="lastName" id="lastName" >Last Name:</label></td>
<td><input type="text" name="last_name" class="inputField" /></td>
</tr>
<tr>
<td class="formLabel"><label for="yourEmail" id="yourEmail" >Your Email:</label></td>
<td><input type="user_email" name="email" class="inputField" /></td>
</tr>
<tr>
<td class="formLabel"><label for="yourEmail2" id="yourEmail2">Re-enter Email:</label></td>
<td><input type="email" name="reEnter_email" class="inputField" /></td>
</tr>
<tr>
<td class="formLabel"><label for="password" id="password">New Password:</label></td>
<td><input type="password" name="password" class="inputField" /></td>
</tr>
<tr>
<td class="formLabel"><label for="gender" id="gender" class="formLabel">I am:</label></td>
<td><select name="gender" class="selectMenu selectMenu1 gender">
<option value="select">Select Sex:</option>
<option value="male" name="male">Male</option>
<option value="female" name="female">Female</option>
</select>
</td>
</tr>
<tr>
<td class="formLabel"><label for="bday">Birthday:</label></td>
<td>
<select name="bday_month" class="selectMenu selectMenu1 bday">
<option value="male">Month:</option>
<option value="January">January</option>
</select>
<select name="bday_day" class="selectMenu bday">
<option value="Day">Day:</option>
<option value="1">1</option>
</select>
<select name="bday_year" class="selectMenu bday">
<option value="Year">Year:</option>
</select>
</td>
</tr>
<tr>
<td class="submitTd" colspan="2"><input type="submit" value="Sign Up" name="submit" class="submit signup" /><td>
</tr>
<input type="hidden" name="MM_insert" value="form1" />
</form>
</table>
<!-- end .sidebar1 --></div>
<div class="content">
<h1>CSSU</h1>
<!-- end .content --></div>
<div class="footer">
<!-- end .footer --></div>
</div> <!-- end container2 -->
<!-- end .container --></div>
</body>
</html>
And here is user_registration.php code just for the first_name field...
<?php
$errors = array();
if ($_POST) {
// run the validation script
require_once('library.php');
try {
// main script goes here
$val = new Zend_Validate_Regex('/^[a-z]+[-\'a-z ]+$/i');
if (!$val->isValid($_POST['first_name'])) {
$errors['first_name'] = 'Required field, no numbers';
} catch (Exception $e) {
echo $e->getMessage();
And from here, here is the library.php code....
<?php
$library = '.../html/zend/library';
set_include_path(get_include_path() . PATH_SEPARATOR . $library);
require_once('Zend/Loader/Autoloader.php');
try {
Zend_Loader_Autoloader::getInstance();
$write = array('host' => 'hostname',
'username' => 'cssu',
'password' => 'password',
'dbname' => 'cssu');
$read = array('host' => 'hostname',
'username' => 'cssu',
'password' => 'password',
'dbname' => 'cssu');
// Comment out the next two lines if using mysqli
// and remove the comments from the last two lines
$dbWrite = new Zend_Db_Adapter_Pdo_Mysql($write);
$dbRead = new Zend_Db_Adapter_Pdo_Mysql($read);
//$dbWrite = new Zend_Db_Adapter_Mysqli($write);
//$dbRead = new Zend_Db_Adapter_Mysqli($read);
} catch (Exception $e) {
echo $e->getMessage();
I replaced some code here to protect myself, but the library.php file is completely functional and has been tested... I am sure the problem ins't in here.
Please let me know if you need any further code to help you out. I am brand new to PHP and so far everything has ran smoothly up til now. I have my Zend Framework uploaded to my server and tested that my site is connecting to it properly. Any help on this would be so so awesome! This is for a school project and I can't move on until this is resolved! Thank you so much for trying!
You can also view the issue at my website... all the files have been uploaded to the server. www.CSSU.com
I am in the chapter teaching about form validation with the Zend Framework. I have done the entire lesson with the lesson files and everything works perfectly...
but I went back to use the form valdation techniques for my own site and it is not working properly. In the book, Chapter 6 teaches how to create a user login and editing the database through the site. But in chapter seven the form validation does not build on top of this and therefore does not teach how to integrate the form validation with the registered user already set up.
I have user registration completly working on my site and everything runs fine. I am trying to add the form validation but it is all completly ignored. When I leave a field blank it simply takes me to another blank page that reads "Column 'first_name' cannot be null"
here is index.php code...
<?php require_once('Connections/CSSU_Write.php'); ?>
<?php require_once('Connections/CSSU_Read.php'); ?>
<?php require_once('script/user_registration.php');
?>
<?php
if (isset($_POST['password'])) {
$_POST['password'] = sha1($_POST['password']);
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;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO sign_up (first_name, family_name, user_email, password, gender, bday_month, bday_day, bday_year) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['first_name'], "text"),
GetSQLValueString($_POST['last_name'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['gender'], "text"),
GetSQLValueString($_POST['bday_month'], "text"),
GetSQLValueString($_POST['bday_day'], "text"),
GetSQLValueString($_POST['bday_year'], "text"));
mysql_select_db($database_CSSU_Write, $CSSU_Write);
$Result1 = mysql_query($insertSQL, $CSSU_Write) or die(mysql_error());
$insertGoTo = "login.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $insertGoTo));
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
if (isset($_POST['email'])) {
$loginUsername=$_POST['email'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "logoOutRedirect.php";
$MM_redirectLoginFailed = "logoOutRedirect.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_CSSU_Write, $CSSU_Write);
$LoginRS__query=sprintf("SELECT user_email, password FROM sign_up WHERE user_email=%s AND password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $CSSU_Write) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
header("Location: " . $MM_redirectLoginSuccess );
else {
header("Location: ". $MM_redirectLoginFailed );
?>
<!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>CSSU</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="container">
<div class="header">
<div class="logo">
<a href="index.php">
<h1/>
.CSSU { UNIVERSITY; }
</h1>
<h2>
<code><<code>!</code>-- Learn/Apply/Master --></code>
</h2>
</a>
</div>
<!-- end .header --></div>
<div class="headerBar">
<div id="nav">
<ul id="links">
<a href="#"><li>CSSU</li></a>
<a href="#"><li>Classes</li></a>
<a href="#"><li>Pricing</li></a>
<a href="#"><li>Degree</li></a>
</ul>
</div>
<form name="form2" method="POST" action="<?php echo $loginFormAction; ?>" class="form2">
<p>
<label for="email" id="email" class="loginLabel">Email:</label>
<input type="email" name="email" class="loginField" />
<label for="password" id="password" class="loginLabel">Password:</label>
<input type="password" name="password" class="loginField" />
<input type="submit" value="Log In" name="submit" class="submit login" />
</p>
</form>
</div>
<div class="container2">
<div class="sidebar1">
<h1>Sign Up</h1>
<h2>Earn an Official CSS Masters Certification!</h2>
<table>
<form name="form1" method="POST" action="<?php echo $editFormAction; ?>" class="form1">
<tr >
<td class="formLabel"><label for="firstName" id="firstNameLabel" >First Name:</label>
<span>
<?php
if ($_POST && isset($errors['first_name'])) {
echo $errors['first_name'];
?>
</span>
</td>
<td><input type="text" name="first_name" class="inputField" id="firstName" /></td>
</tr>
<tr>
<td class="formLabel"><label for="lastName" id="lastName" >Last Name:</label></td>
<td><input type="text" name="last_name" class="inputField" /></td>
</tr>
<tr>
<td class="formLabel"><label for="yourEmail" id="yourEmail" >Your Email:</label></td>
<td><input type="user_email" name="email" class="inputField" /></td>
</tr>
<tr>
<td class="formLabel"><label for="yourEmail2" id="yourEmail2">Re-enter Email:</label></td>
<td><input type="email" name="reEnter_email" class="inputField" /></td>
</tr>
<tr>
<td class="formLabel"><label for="password" id="password">New Password:</label></td>
<td><input type="password" name="password" class="inputField" /></td>
</tr>
<tr>
<td class="formLabel"><label for="gender" id="gender" class="formLabel">I am:</label></td>
<td><select name="gender" class="selectMenu selectMenu1 gender">
<option value="select">Select Sex:</option>
<option value="male" name="male">Male</option>
<option value="female" name="female">Female</option>
</select>
</td>
</tr>
<tr>
<td class="formLabel"><label for="bday">Birthday:</label></td>
<td>
<select name="bday_month" class="selectMenu selectMenu1 bday">
<option value="male">Month:</option>
<option value="January">January</option>
</select>
<select name="bday_day" class="selectMenu bday">
<option value="Day">Day:</option>
<option value="1">1</option>
</select>
<select name="bday_year" class="selectMenu bday">
<option value="Year">Year:</option>
</select>
</td>
</tr>
<tr>
<td class="submitTd" colspan="2"><input type="submit" value="Sign Up" name="submit" class="submit signup" /><td>
</tr>
<input type="hidden" name="MM_insert" value="form1" />
</form>
</table>
<!-- end .sidebar1 --></div>
<div class="content">
<h1>CSSU</h1>
<!-- end .content --></div>
<div class="footer">
<!-- end .footer --></div>
</div> <!-- end container2 -->
<!-- end .container --></div>
</body>
</html>
And here is user_registration.php code just for the first_name field...
<?php
$errors = array();
if ($_POST) {
// run the validation script
require_once('library.php');
try {
// main script goes here
$val = new Zend_Validate_Regex('/^[a-z]+[-\'a-z ]+$/i');
if (!$val->isValid($_POST['first_name'])) {
$errors['first_name'] = 'Required field, no numbers';
} catch (Exception $e) {
echo $e->getMessage();
And from here, here is the library.php code....
<?php
$library = '.../html/zend/library';
set_include_path(get_include_path() . PATH_SEPARATOR . $library);
require_once('Zend/Loader/Autoloader.php');
try {
Zend_Loader_Autoloader::getInstance();
$write = array('host' => 'hostname',
'username' => 'cssu',
'password' => 'password',
'dbname' => 'cssu');
$read = array('host' => 'hostname',
'username' => 'cssu',
'password' => 'password',
'dbname' => 'cssu');
// Comment out the next two lines if using mysqli
// and remove the comments from the last two lines
$dbWrite = new Zend_Db_Adapter_Pdo_Mysql($write);
$dbRead = new Zend_Db_Adapter_Pdo_Mysql($read);
//$dbWrite = new Zend_Db_Adapter_Mysqli($write);
//$dbRead = new Zend_Db_Adapter_Mysqli($read);
} catch (Exception $e) {
echo $e->getMessage();
I replaced some code here to protect myself, but the library.php file is completely functional and has been tested... I am sure the problem ins't in here.
Please let me know if you need any further code to help you out. I am brand new to PHP and so far everything has ran smoothly up til now. I have my Zend Framework uploaded to my server and tested that my site is connecting to it properly. Any help on this would be so so awesome! This is for a school project and I can't move on until this is resolved! Thank you so much for trying!
You can also view the issue at my website... all the files have been uploaded to the server. www.CSSU.com
Similar Messages
-
Need help regarding form validation
Hi all,
I have particular doubt regarding form validation. I have a form based on a table. ( One data block ) . I have a function in program unit which return boolean value based on some conditions. I will be calling this function in block validate trigger.
What i need is , if function return false i need to stop any insertion,updation action that's going to be done by forms.( point to control insertion and updation)
I don't want to use form triggure failure builtin. What should i do ? plz guide
regardswhat are you going to do stop insert/update upon commit?
-- use on-insert trigger
if allowed_to_insert then
insert_record;
end if;
-- use on-update trigger
if allowed_to_update then
update_record;
end if;
if when entering data, you might want to check set_block_property -
How do I do form validation in dreamweaver cc 2014?
I understand spry validation has gone away. And I read somewhere it was replaced by jquery - but I'm not seeing that anywhere in cc 2014.
I use HTML5 forms now which contain a fair amount of built-in form validation. However, my main validation comes from PHP code in my form processing script. I can't emphasize this enough, the only reliable way to validate forms is with server-side code. Client-side validation (Spry, jQuery, etc..) is not 100% reliable because it uses JavaScript which can be turned off in browsers.
Sometimes I need to support older browsers that don't honor the required attribute in HTML5 forms. Bring out jQuery Validate. It's lightweight, simple, and offers site users a nice visual clue when a required field is missing. See example below. View source in browser to see the code.
HTML5 Form with jQuery Validation
All that said, jQuery validate is strictly cosmetic. The real work is done with PHP.
Nancy O. -
Adobe form validation with Print button
Hi All,
I have an adobe form with field validation (javascript) already set up but I'm trying to add one more feature to the validation.
Let me explain my initial validation first: I have 18 required fields with their tooltip name having an '*' at the end. Any fields not filled in with this tooltip marker will show up on an alert message when the print button is selected.
There are two fields called IException and Amount that are required but an End User might have additional IExceptions and corresponding Amounts. Therefore I have created 5 textboxes for each but only the first IException and Amount are absolutely required (and I use a '*' within their tooltip). Now if an End User has an additional IExceptions ("IException2") and fills out this field, I need to make it mandatory that "Amount2" would also have to be filled in.
Here is my code: [code]
function validateFields()
var flg = 0
var n = this.numFields
var fArr = new Array();
for(var i = 0;i<n;i++)
var fn = this.getNthFieldName(i);
var f = this.getField(fn);
var tt = f.userName
if(tt.indexOf('*')!=-1 && f.value == f.defaultValue)
flg++;
fArr[fArr.length] = tt;
if(flg>0)
app.alert('There are '+flg+' fields that require a value\n\n'+ fArr,3)
var IException2 = document.getElementById('IException2').value;
var Amount2 = document.getElementById('Amount2').value;
if ((IException2.length >0) && (Amount2.length == 0))
app.alert('Amount is missing')
else
document.ExceptionForm1.print();
validateFields();
[/code]
Currently when one of the require fields is NOT filled in, i receive my first alert message. If all required fields are filled in my print button doesn't work. Also if all required fields are filled in and IException2 is also filled in but Amount2 is not, I don't receive my second Alert message. So my code works up to the "Var IException2 = document....." and I don't know what the issue is.
Thank you for your help in advance.One more question, since I have 4 of these...I'm having trouble getting the button to do exactly what its suppose to based on what's filled in because i think i have my '{ }' messed up and or IF/ELSE statement is wrong...can you please take a look..
function validateFields()
var flg = 0
var n = this.numFields
var fArr = new Array();
for(var i = 0;i<n;i++)
var fn = this.getNthFieldName(i);
var f = this.getField(fn);
var tt = f.userName
if(tt.indexOf('*')!=-1 && f.value == f.defaultValue)
flg++;
fArr[fArr.length] = tt;
if(flg>0)
app.alert('There are '+flg+' fields that require a value\n\n'+ fArr,3)
var a = this.getField('IException2').value;
var b= this.getField('Amount2').value;
if ((a.length >0) && (b.length == 0))
app.alert('Since IException 2 is filled in, Amount 2 is also required')
var c = this.getField('IException3').value;
var d= this.getField('Amount3').value;
if ((c.length >0) && (d.length == 0))
app.alert('Since IException 3 is filled in, Amount 3 is also required')
var e = this.getField('IException4').value;
var f= this.getField('Amount4').value;
if ((e.length >0) && (f.length == 0))
app.alert('Since IException 4 is filled in, Amount 4 is also required')
var g = this.getField('IException5').value;
var h= this.getField('Amount5').value;
if ((g.length >0) && (h.length == 0))
app.alert('Since IException 5 is filled in, Amount 5 is also required')
else
this.print();
validateFields(); -
Hi there
I have a form on a webpage that I have altered that works
fine when submitted ..however there are 2 fields that don't show up
in the received email ..The boy/girl radio button selection and the
Related Radio button group (6 selections)
Can anyone help me solve this problem ..the setup is below
..thanks RobWouldn't "gender" be a more appropriate usage than "sex". I
doubt that this
distinction is what is causing the problem, though! 8)
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"Alan" <[email protected]> wrote in
message
news:C43CB10E.2F95F4%[email protected]...
>
>
> <input type="radio" name="Relatedchild" value="radio"
id="HowRelated_0">
>
> If you use both name and ID, they must match.
>
> <input name="Childsexboy" type="radio" value="radio1"
id="Childsex_0">
> <input name="Childsexgirl" type="radio"
value="radio1" id="Childsex_1">
>
> same issue about name and id not matching, and also, a
"set" of radio
> buttons must use the same name/id for them to work as
radio buttons. That
> way only one of them can be selected at a time.
>
> The asp must match the same name/id to retrieve the
values.
>
> There is nothing in the asp section to put the values
for the child's sex
> or
> relation into the outgoing email.
>
> Fix:
> change the name/id of the two sex radio buttons. Use the
VALUE to set the
> information you want.
> <input name="ChildsSex" type="radio" value="male"
id="ChildsSex">
> <input name="ChildsSex" type="radio" value="female"
id="ChildsSex">
>
> then add a line in the asp to put the ChildsSex data
into the outgoing
> email.
>
> "Child's Sex: " & Request.Form("ChildsSex") &
vbcrlf & _
>
> Repeat for the Related radio buttons.
> Give ALL of them the same name and id.
> use the value to set the ... value you want. And put a
line in the asp to
> get and sent the value for that form field.
>
> instead of:
> <input type="radio" name="Relatedgrandchild"
value="radio"
> id="HowRelated_1">
>
> something like:
> <input type="radio" name="Relationship"
value="grandchild"
> id="Relationship">
>
>
>
> --
> Alan
> Adobe Community Expert, dreamweaver
>
>
http://www.adobe.com/communities/experts/
>
>
> -
Need help with a form created with Dreamweaver CS5...
How can I make a text field automatically jump to the next field when text is inputted? I've created a credit card payment form for a client and want to know how to make the cursor jump to the next available text field when the customer has input text. Hope this makes sense.
Have a look here http://www.mathachew.com/sandbox/jquery-autotab/
-
Need help adapting David Powers PHP email form script please!
Hi all,
I'm fairly inexperienced with PHP and I'm trying to adapt the David Powers email form script from THE ESSENTIAL GUIDE TO DREAMWEAVER CS4 WITH CSS, AJAX, AND PHP.
I've created a basic form so that visitors to the site can request a telephone call back from the site owner. The form asks the visitor for their name, telephone number and to select a time of day suitable for the telephone call to be made using radio buttons selecting between morning and afternoon.
I'd like to achieve my goal with minimal validation error messages and would like to redirect to another page when a message is sent successfully. It is also important that in the spirit of the David Powers script I'm trying to work with, that it filters out suspect input, avoids email header injection attacks and blocks submission by spam bots.
There may be a really simple solution to this since I don't want users to be able to enter an email address at all but I don't know enough to be able to figure it out just yet.
I'd be grateful for any advice.
See below for the code for the form including PHP so far...
Thanks to everyone looking in in advance
Karl.GEAtkins wrote:
> I am using the redirect to a personal page from page 515
of The Essential
> Guide to DWCS3 in the following form:
$_SESSION[MM_Username].php in the "if
> login succeeds" field.
Thank you for reminding me. There's a mistake in the book,
which I
discovered over the Christmas period, so forgot to send to
friends of ED
for the errata page.
Don't use $_SESSION[MM_Username]. Use $loginUsername instead.
It then works.
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
"Adobe Dreamweaver PHP Training from David Powers
“Adobe® Dreamweaver® CS5 with PHP Training from the Source David Powers
Lesson 7 Validating Input on the Server
I have reached page 445, and become completely stuck - I've been about three weeks trying to sort the problem but cant get anywhere. Not sure what to do from here so any advice would be really appreciated. The problem:
I have completed the script exactly as instructed, when I go live (local sever), I get a blank screen, OK, does not display. I am sure this is something simple but I have done all the fault finding and am out foxed. I know the local server works OK - I completed chapter 6 successfully - I can also run a php test page from the local folder that the file is stored in. i.e provictis/phpcs5. I have saved my ZendFraework in a separate location as advised. i.e. User/SPENNY/...
This is the basic code:
<?php
$library='/Users/SPENNY/ZendFramework/library';
set_include_path(get_include_path() . PATH_SEPARATOR .
$library);
require_once('Zend/Loader/Autoloader.php');
$loader=Zend_Loader_Autoloader::getInstance();
if ($loader) {
echo 'ok';
} else {
echo 'Huston we have a blinkin problem, but do not panic we will get things sorted';
GarethFIXED!!
1)
i finally did get the message problem was with:
$mailhost='ssl://mail.domain.com';
ssl:// was just nonsense and been removed
2)
'auth' => 'true' was changed to 'auth' => 'login'
3)
for bluehost i got information that it was tls secure connection protocol not ssl
'ssl' => 'tls'
4)
port used '25' not 465.
Didnt still tried 26 and 465 maybe they would work too. -
Using MySql and PHP with Dreamweaver on a Mac
Hello all,
As always if the answers to these questions are obscenely
obvious please humour me.
I use XHTML and CSS in my websites and realise that it is
time that I dabbled with SSI. So I've started using PHP.
However, I have been following the installation directions of
MySql and am running into problems. I am installing the relavent
software and am then unable to find it on my Mac, the startup files
are there but the actual MySql data appears to not be installed
despite my computer telling me it is...... I am using a G3 running
OSX 10.4 is this good enough? I noticed talk of needing a PowerPC
or Intel mac. Is this the case?
Also, would I need MySql installed on my actual computer if
the my servers have it already? And does Dreamweaver 8 have both of
these programs installed as standard?
If you could help out I would be very appreciative as I would
like to learn this stuff and I appear to be struggling at the
outset....
Cheers
M.AM.A.Wilson wrote:
> However, I have been following the installation
directions of MySql and am
> running into problems. I am installing the relavent
software and am then unable
> to find it on my Mac, the startup files are there but
the actual MySql data
> appears to not be installed despite my computer telling
me it is...... I am
> using a G3 running OSX 10.4 is this good enough? I
noticed talk of needing a
> PowerPC or Intel mac. Is this the case?
MySQL is a relational database management system that
comprises a
database server and several utility programs. Although you
install it
like any other program on a Mac, the similarity stops there.
First, the point about PowerPC and Intel Macs is that there
are
different versions of the MySQL installer for each type of
processor.
I'm pretty sure that a G3 is OK, but you must choose the
PowerPC version
of MySQL, not the 64-bit or x86 (Intel Mac) version.
Once you have installed MySQL, you need to drag the
MySQL.PrefPane icon
from the disk image onto your System Preferences. This
installs a
Preference Pane that enables you to start and stop MySQL. The
Preference
Pane has an option to start up MySQL automatically, but in my
experience, it doesn't work on Tiger. You need to open the
Preference
Pane, and click Start MySQL Server each time you start your
computer.
The best way to work with MySQL is to use a graphical
interface, such as
phpMyAdmin. As Osgood has mentioned, I have written a book
about PHP and
Dreamweaver, which goes into all the necessary details. It's
also very
Mac-friendly with separate instructions where necessary for
PC and Mac.
More details here:
http://foundationphp.com/dreamweaver8/
David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/ -
David (php guru that you are
, this is directed to you as I have no
concept of this wee problem I have.
I signed up with a new unix host, so that I could set up a
link directory
script for testing purposes. According to the help doc, once
I typed in the
path to the install script, this "you bewt" script was
supposed to install
itself and away I'd go. I had the following from the host
after I asked why
I was getting an 'internal error' trying to run the scrip:
"the reason you are getting the internal server error is
because we do not
allow mod rewrites in the htaccess file. If you need to use
these we can
add them to your hosting container on the server. Please let
us know."
What does this mean exactly and would adding them for my use
cause problems
for my site or any other user on the server?
Nadia
Adobe� Community Expert : Dreamweaver
http://www.csstemplates.com.au
- CSS Templates | Free Templates
http://www.DreamweaverResources.com
- Dropdown Menu Templates|Tutorials
http://www.macromedia.com/devnet/dreamweaver/css.html
- CSS TutorialsThanks David,
I asked the new host (who were suprisingly quick to respond
to my initial
support ticket - considering the time differences) to add the
mod, which
they did within minutes of my request. Now however, I'm
getting a
"forbidden' error.
So off to email them again ;-)
PS: I even get a standard install of Wordpress with the host,
so will
definitely have to get to your book one day soon !
Nadia
Adobe� Community Expert : Dreamweaver
http://www.csstemplates.com.au
- CSS Templates | Free Templates
http://www.DreamweaverResources.com
- Dropdown Menu Templates|Tutorials
http://www.macromedia.com/devnet/dreamweaver/css.html
- CSS Tutorials
"David Powers" <[email protected]> wrote in message
news:[email protected]...
> .: Nadia :. *ACE* wrote:
>> David (php guru that you are
, this is directed to you as I have no
>> concept of this wee problem I have.
>
> That's very nice of you, Nadia, but mod_rewrite has
nothing to do with
> PHP; it's an Apache module.
>
>> "the reason you are getting the internal server
error is because we do
>> not allow mod rewrites in the htaccess file. If you
need to use these we
>> can add them to your hosting container on the
server. Please let us
>> know."
>>
>> What does this mean exactly and would adding them
for my use cause
>> problems for my site or any other user on the
server?
>
> It means you can't add a mod_rewrite command through
.htaccess, but the
> server administrator is willing to do it for you. If
it's set up
> correctly, it should have no impact on your current site
or anyone else's.
>
> Disclaimer: my knowledge of Apache is basically limited
to simple things,
> such as installing PHP, creating virtual hosts, and a
little maintenance.
> I leave things like mod_rewrite to the experts.
WordPress uses mod_rewrite
> to provide nice looking links to blog entries. I use it
on my site, but
> all the mod_rewrite stuff is handled by WordPress. I
haven't touched it
> myself.
>
> --
> David Powers
> Author, "Foundation PHP for Dreamweaver 8" (friends of
ED)
> Author, "Foundation PHP 5 for Flash" (friends of ED)
>
http://foundationphp.com/ -
SunOne 7 FORM Validation & Initial page
Hi All.
I have an application running in a Sun One 7 Server. I use LDAP for validation and I have configured a FORM validation, with two html's for login and error.
All goes OK, when I'm trying to get the initial JSP of the application, the login form comes. But when I validate, my browser calls an image of the JSP instead of the JSP.
It seems like the JSP tryes to load this image and then the validation starts. But when I validate, Sun One don't remember that the JSP called the image and only load the image.
I'm blocked and I don't find nothing in the documentation. In the logs nothing appears to be bad.
Somebody could help me, please?
Thanks a lot.
Daniel.hi
i need to authenticate the requests of my sun application server with an ldap server.
u told that u have configured how to connect sun app sever and ldap server....
I need to do the same for my project......so pls help me
ill b thankful to u..
u can mail ur reply at [email protected]
[email protected]
or here -
Help with Dreamweaver Validate Form Behavior
Hello,
I'm attempting to use Dreamweaver to validate form fields. This would work quite well except for in this case I'm using custom form code which is coming from Salesforce.com. The issue has been that the Salesforce.com web-to-lead form comes with "name" attributes on every form field item. If I change these names to make the validation look nicer, for example from first_name to First Name, then the web to lead form breaks. Is there another way to utilize Dreamweavers form validation by creating by own names for each form element instead of using "name"? The objective is to give the user something that looks good... like:
First Name is required
Last Name is required
And with the Salesforce custom name fields it ends up looking like:
900000xxxxx213s is required
or
last_name is required
Thanks for any help!The name attribute of a form cannot contain spaces. That's why the validation behavior breaks.
The Dreamweaver Validate Form behavior is rather crude and well past its sell-by date. Use the Spry Validation widgets instead: http://help.adobe.com/en_US/Dreamweaver/10.0_Using/WS267C8659-3AEF-4956-8268-E38CA4CAFAD3a .html. -
The Essential Guide to Dreamweaver CS3 with CSS, Ajax, and PHP by David Powers
The Essential Guide to Dreamweaver CS3 with CSS, Ajax, and
PHP by David Powers:
Would this book help me learn about Spry and Ajax and how
applications can be made with them, if I my e-commerce site runs on
a compiled C code shopping cart (ShopSite) but supports PHP
server-side scripts or is it only for shopping carts based on PHP
itself (like X-Cart)?
I am not sure. Someone please let me know so I can purchase
this book. Thanks.ahsenabro wrote:
> 1. Do I have to be a developer/programmer in order to
learn from this book or
> can a tech-savvy entrepreneur can also get some gems out
of it and direct his
> programmer?
You don't need any prior knowledge of Ajax or PHP, but you do
need to
know the basics of HTML and CSS. As I say in the
introduction, "You
don't need to be an expert, but you do need to have an
inquiring mind.
It doesn't teach the basics of web design, nor does it
attempt to list
every single feature in Dreamweaver CS3. There are plenty of
other books
to fill that gap. However, by working through this book,
you'll gain an
in-depth knowledge of the most important features of
Dreamweaver."
> 2. I am interested in purchasing this book mainly to
implement cool Ajax/Spry
> stuff on my e-commerce site. I am asking about PHP
because the book's content
> mentions making a PHP site. Now I realize this book is
not about shopping
> carts, but the Ajax/Spry stuff can be implemented on
e-commerce sites, right?
The book provides detailed coverage of the Spry 1.4 features
in
Dreamweaver CS3, which can be applied to any site. With minor
adaptation, you can also use Spry 1.6. It's important to
realize,
though, that the Spry/Ajax features in Dreamweaver CS3 do
*not* cover
asynchronous requests to the server. The ability to
communicate
asynchronously with the server was added in Spry 1.6. If it's
asynchronous server calls and responses that you're after,
your
programmer will need to dig around in the Spry 1.6
documentation on the
Adobe Labs site, and hand-code it.
The Spry features covered in the book are Spry Effects, Spry
UI widgets
(menu, accordion, tabbed panels, and collapsible panels),
Spry
Validation Widgets, and Spry XML Data Sets.
> I just want to know if I can learn and implement
Ajax/Spry apps on my
> simple HTML/CSS-based pages, on a server which allows
server-side PHP scripts
> but the pages themselves are not with .php extension. Is
this book still going
> to be applicable?
Yes. All the Spry techniques can be used on any web page. It
doesn't
need to be a PHP one.
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
Form Validation against database - Dreamweaver CS4 Spry
Hi all,
I'm trying to figure out how to implement a form validation
of some fields, let's say a username. I have a form that inserts on
MySQL table, and when the user is typing the username, after it
looses the focus on field, validate it if there is a record on
table with the specified username. If so, validation will fail.
I already saw something similar with this on Dreamweaver MX
using some extension (because at that time, it did not support
ajax).
Kind regards, and thanks in advance.I don't have a solution, but you may try posting in the Spry
Forums, you might get a better response.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=72&catid=602 -
I have adapted a php contact form of David Powers tut
Hi I have slowly changed according to my research etc. I am
worried that since changing things that I have left some important
error checking.
Well here is the error checking and the form:
<h2><span class="black">contact us :
</span></h2>
<span class="errmsg1">
<?php
if ($error) {
echo 'Please complete the missing item(s) indicated.';
// remove escape characters from POST array
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value) {
$value = is_array($value) ? array_map('stripslashes_deep',
$value) : stripslashes($value);
return $value;
$_POST = array_map('stripslashes_deep', $_POST);
?>
</span>
<form name="option" id="option" method="post"
action="<?php $_SERVER['PHP_SELF']; ?>">
<label> </label>
<table width="70%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td>Your Name</td>
<td><input name="name" type="text" class="search"
id="name" value="<?php if (isset($_POST['name'])) {
echo htmlentities($_POST['name']);} ?>" size="30"
maxlength="50" /></td>
</tr>
<tr>
<td> </td>
<td><?php if (isset($error['name'])) { ?>
<span class="errmsg1"><?php echo $error['name'];
?></span>
<?php } ?> </td>
</tr>
<tr>
<td><span class="subheader">Your Email
Address</span></td>
<td><span class="subheader">
<input name="email" type="text" id="email"
value="<?php if (isset($_POST['email'])) {
echo htmlentities($_POST['email']);} ?>" size="30"
maxlength="80" />
</span></td>
</tr>
<tr>
<td> </td>
<td><?php if (isset($error['email'])) { ?>
<span class="errmsg1"><?php echo $error['email'];
?></span>
<?php } ?> </td>
</tr>
<tr>
<td>Reason For Enquiry </td>
<td><label>
<select name="option">
<option value="">Please Select Option</option>
<option value="complaint"<?php
if (isset($error) && $_POST['option'] ==
'complaint') { ?>
selected="selected"
<?php } ?>>Complaints</option>
<option value="listbusiness"<?php
if (isset($error) && $_POST['option'] ==
'listbusiness') { ?>
selected="selected"
<?php } ?>>List My Business </option>
<option value="removelisting"<?php
if (isset($error) && $_POST['option'] ==
'removelisting') { ?>
selected="selected"
<?php } ?>>Remove My Listing</option>
<option value="upgradelisting"<?php
if (isset($error) && $_POST['option'] ==
'upgradelisting') { ?>
selected="selected"
<?php } ?>>Upgrade Listing</option>
<option value="banner"<?php
if (isset($error) && $_POST['option'] == 'banner') {
?>
selected="selected"
<?php } ?>>Banner Advertising</option>
<option value="agentenquiry"<?php
if (isset($error) && $_POST['option'] ==
'agentenquiry') { ?>
selected="selected"
<?php } ?>>Become An Agent</option>
<option value="other"<?php
if (isset($error) && $_POST['option'] == 'other') {
?>
selected="selected"
<?php } ?>>Other</option>
</select>
</label></td>
</tr>
<tr>
<td> </td>
<td><?php if (isset($error['option'])) { ?>
<span class="errmsg1"><?php echo $error['option'];
?></span>
<?php } ?> </td>
</tr>
<tr>
<td>Message</td>
<td><label>
<textarea name="message" cols="30" rows="3"
id="message"><?php if(isset($error)) {echo $messageBody;}
?>
</textarea>
</label></td>
</tr>
<tr>
<td> </td>
<td><?php if (isset($error['message'])) { ?>
<span class="errmsg1"><?php echo $error['message'];
?></span>
<?php } ?> </td>
</tr>
<tr>
<td> </td>
<td><label>
<input name="send" type="submit" class="searchbutton"
id="send" value="Enquiry" />
</label></td>
</tr>
</table>
<label> </label>
<p><span class="subheader">
<label> </label>
</span></p>
</form>jjjhbj111 wrote:
> Hi I have slowly changed according to my research etc. I
am worried that since
> changing things that I have left some important error
checking.
I haven't gone through your script with a fine-tooth comb,
but your
email check uses a POSIX regular expression, which won't work
with
preg_match(). You could use eregi() instead, but there are
plans to
remove the ereg_ functions from PHP 6, so you would be better
advised to
stick with Perl-compatible regular expressions (PCRE).
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Maybe you are looking for
-
Got a problem with my MacBook Pro here. Just appeared today, On every startup I get a lot of "system sounds" running. You know... like when you connect a cable, or connect to a network, or get a notification and so on. I've heard the sound before som
-
Time conversion problem using sql developer
Hi, I migrated my data from sql server 2 oracle 10g using the following procedure 1.Created a ODBC from Access-2003 to sql server 2.Imported the tables 3. Used Quick migrate feature in SQL DEVELOPER 2 migrate the data to oracle.... Now when i view th
-
HI All, Can anyone Answer this I have 5 Requests in ODS, Third one having Error, If I Delete 3rd Request, What will be the impact on ODS? Regards, Kiran Telkar
-
Where can I find Professional Dreamweaver Templates?
Greetings. In efforts to browse Dreamweaver templates for sale, I am bomboarded with many sites that seem to be flogging the same templates -- which raises some suspicions to begin with. I do not mind paying for a Dreamweaver template, but I'd like
-
I have Photoshop CC, InDesign CC, and Lightroom CC installed, and updates generally work. I also have PS6 and ID6 on my machine, but the updates always fail. Any advice? Thanks.