close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

not validating on client side

Thread began 10/10/2010 9:26 am by watercolor346374 | Last modified 10/14/2010 4:17 pm by Jason Byrnes | 1313 views | 9 replies |

watercolor346374

not validating on client side

Hello,
I am using the validation tools for client side validation. This is a simple form that allows one to add recipes to a recipe site. I am using includes ie: the main file is recipe.php and other files associated with the recipe section are inc files. I have used this tool before with ecart and it worked like a gem, now it will not validate this form. This file is newrecipe.inc.php and it posts to addrecipe.inc. php. When I click submit it goes to addrecipe.inc.php, no validation on blank fields. The info that is added to newrecipe is posted to the database. I have submitted my file.
Thank you

Attached Files
newrecipe.inc.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

for some reason the regular exprtession validation function was not added to the script tag in the head.


add the following code to the script in the head to define the regular expresion validation:

function WAValidateRX(formElement,inputType,regExStr,errorMsg,focusIt,stopIt,required)  {
var isValid = true;
var value=WAFV_GetValueFromInputType(formElement,inputType,required);
var extraArgs = regExStr.substring(regExStr.lastIndexOf("/")+1);
regExStr = regExStr.substring(regExStr.indexOf("/")+1,regExStr.lastIndexOf("/"));
regExStr = regExStr.replace(/"/g,'"');
var regEx = new RegExp(regExStr,extraArgs);
if ((!document.WAFV_Stop && !formElement.WAFV_Stop) && !(!required && value=="")) {
var theMatch = regEx.test(value);
if (!theMatch) {
isValid = false;
}
}
if (!isValid) {
WAAddError(formElement,errorMsg,focusIt,stopIt);
}
}
Sign in to reply to this post

watercolor346374

script still will not validate

Thank you, I did as you said and the script still goes through without validation. I sent along the script with the added lines.
Thank you

Attached Files
newrecipe.inc.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

it works when I test your page on my system.

Does the main page this one is being included into have a form on it? if so you will need to replace each form reference:
document.forms[0]


with:
document.forms[1]

Sign in to reply to this post

watercolor346374

validation not showing

The main page that this is included in is barebones: recipe.php
<?php
session_start();//starts the session cookie
?>
<?php
include("mylibrary/showrecipe.php");
?><!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>Recipe</title>
<link href="kshotz.css" rel="stylesheet" type="text/css" />

</head>

<body>
<div id="container">

<div id="header">
<?php include("header.include.php");
?>
</div>
<div id="nav">
<div align="center"><?php include('navbar.include.php'); ?></div>

</div>
<div id="leftsidebar"><?php include('recipenav.include.php'); ?>
</div>

<div id="main">




<div class ="content"><?php if (!isset($_REQUEST['content'])) include("mainrecipe.inc.php");
else
{
$content = $_REQUEST['content'];
$nextpage = $content . ".inc.php"; include($nextpage);
}
?>
</div>

<div class="rightsidebar">
<div class="lastview">
<?php include("lastview.inc.php");
?>
</div>

</div>

</div>


<div id="footer">
<?php include("footer.include.php");
?>
</div></div>
</body>
</html>
There is a page that shows specific recipes and it does have an addcomment, that links to the addcomment.inc.php include. addcomment.inc.php and newrecipe.inc.php are included into recipe.php. Would this make a difference?

Also, changed the document forms to 1 and still does not work.

Sign in to reply to this post

Jason ByrnesWebAssist

can you send a link where I can see the problem so I can investigate the cause.

Sign in to reply to this post

watercolor346374

validation not showing or working

Hi Jason,
Here is the link:
recipe.php?content=newrecipe
the main url is kshotz.com then go to recipies and then add a new recipe.
Thank you,
K

Sign in to reply to this post

Jason ByrnesWebAssist

there are 2 other forms on this page before the main one you are validating.

change each instance of:
document.forms[0]

to:
document.forms[2]

Sign in to reply to this post

watercolor346374

validation not showing or totally workin

Hi Jason,
Making progress with this. I looked at the script and some major stuff was not added correctly. IE- instead of the correct variable for each form variable they all had: document.forms[2].title
So I changed it,now I get validation on all text but not for the drop downs. I checked them to old scripts that work and made the changes, but did not work. I am including the script and the link is recipe.php?content=newrecipe
This is very strange that so much was left out when I ran the wizard, it has always worked.
Thank you,
K

Attached Files
newrecipe.inc.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

you have regular expression validations applied to this form that are missing the regular expression to use.

go to Window -> Behaviors to open the behaviors list.

Select the first form element in design view, then select the Form tag from the tag selector.

In the behaviors window, double click each of the regular expression validations to correct them.

Sign in to reply to this post
loading

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...