close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Should this page validate?

Thread began 3/07/2012 5:46 pm by h150477 | Last modified 3/12/2012 3:14 pm by h150477 | 2466 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?

Sign in to reply to this post

h150477

The smily shown above is :) on my page. { a colon : followed by a brace ) }

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of the page please, i need to see the code in context to see the full picture.

Sign in to reply to this post

h150477

File attached

This is the file in zip format

Attached Files
MyZip.zip
Sign in to reply to this post

Jason ByrnesWebAssist

couple of problems:

1) The submit button has a space at the end of the name, spaces are not valid in form element names.

change:

php:
<input name="Insert " type="submit" id="Insert " value="Insert Record">



to:

php:
<input name="Insert" type="submit" id="Insert" value="Insert Record">



so that the name does not contain a space.

2) you have 2 server validation on the page, you should only have 1

Sign in to reply to this post

h150477

Thanks for point 1 - noted.

As to point 2, reading the literature, it seemed to me as though each form field would require a different validation. Are you saying that you can validate all the form fields at the same time, and thus there is only one server validation that validates all the fields. If that is so, it makes the whole process a lot less tedious. It also makes good sense. I will give it a try.

Sign in to reply to this post

Jason ByrnesWebAssist

  Are you saying that you can validate all the form fields at the same time, and thus there is only one server validation that validates all the fields.  




that is exactly what i am saying

Sign in to reply to this post

h150477

That seems to do the trick apart from one small thing:
Click the insert button on the empty form, and the hidden regions all show up. Enter some correct data into the fields and the form is submitted - without any data.

After all the validation has taken place, a blank record is inserted into the database with no content.
All the code checks out in the w3c validator.

File attached

Attached Files
MyZip (1).zip
Sign in to reply to this post

Jason ByrnesWebAssist

in the insert record behavior, you have selected the bindings from the validated entries collection, this collection only has values when the form fails validation.

you need to use the bindings from the form collection instead of from the validated entries collection.

Sign in to reply to this post

h150477

Thanks for the reply.
All I can say is that your Insert single record form is very misleading. One would assume that an item labeled WA validated Entries would contain the entry after validation has taken place, and that these would be inserted into the database.
I take it that one is supposed to use the form variables on the basis that when they are validated, they will be correct.

Perhaps you can explain the purpose of the WA Validated Entries?

Can you also explain the following Javascript error that ocurrs while filling in the form to insert a single record:
While executing onMouseUp in WAAB_Insert_SBV3.htm, the following JavaScript error(s) occurred:
In file "WAAB_Insert_SBV3": focus is not defined

Happens most times.

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