close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Should this page validate?

Thread began 3/07/2012 5:46 pm by h150477 | Last modified 3/12/2012 3:14 pm by h150477 | 2471 views | 11 replies

h150477

Should this page validate?

I have set two fields on my page to be validated if alphanumeric, required and not blank.
The generated code is as follows or very similar for both fields with only the numbers changing:
<?php
if (isset($_POST["Insert "])) {
$WAFV_Redirect = "eventinsert.php";
$_SESSION['WAVT_eventinsert_469_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateAN(((isset($_POST["club_organiser"]))?$_POST["club_organiser"]:"") . "",true,true,true,true,"",true,3);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["club_organiser"]))?$_POST["club_organiser"]:"") . "",true,1);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"eventinsert_469");
}
}
?>
In addition they are both set to show the word "Required" if not validated, and the code is as follows:

<input name="club_organiser" type="text" id="club_organiser" tabindex="1" size="64" maxlength="128"> </td><td class="warning"><?php
if (ValidatedField('eventinsert_469','eventinsert_469')) {
if ((strpos((",".ValidatedField("eventinsert_469","eventinsert_469").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?>
Required
<?php //WAFV_Conditional eventinsert.php eventinsert_469(1:)
}
}
}?></td>

I think that this code should only validate the fields if
1: They are alphanumeric
2: They have content that is not blank
If they do not validate, the page should be refreshed with the words "Required" displayed.


What actually happens is that the fields pass validation regardless of whether they have any content or not, and an invalid empty or partly completed entry is made in my database.
Additionally the " show if " validation fields on them, do not appear to work as expected. They do not show when the form is submitted in any circumstances.
Can anyone tell me what is wrong with the code?
Or am I not applying the behaviours correctly?

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