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

Form submits even with validation applied

Thread began 12/08/2010 7:52 pm by elewis93815 | Last modified 12/15/2010 10:19 am by Jason Byrnes | 1937 views | 5 replies |

elewis93815

Form submits even with validation applied

Hello,

I have recently inserted captcha security on a form that we have created, applied server validation and created an error message if an error occurs. We attempt to generate an error but the form submits.
Not sure if this is a problem however, we are using gdform.php script for the form:
<?php
$request_method = $_SERVER["REQUEST_METHOD"];
if($request_method == "GET"){
$query_vars = $_GET;
} elseif ($request_method == "POST"){
$query_vars = $_POST;
}
reset($query_vars);
$t = date("U");

$file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;
$fp = fopen($file,"w");
while (list ($key, $val) = each ($query_vars)) {
fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
fputs($fp,"$val\n");
fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
if ($key == "redirect") { $landing_page = $val;}
}
fclose($fp);
if ($landing_page != ""){
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
} else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
}


?>

Not sure why this isn't working??? Any help is greatly appreciated.

Thanks,

Jackie

I've also attached the files, if that helps.

Attached Files
WA Captcha problem.zip
Sign in to reply to this post

Jason ByrnesWebAssist

this is the most common problem with forms and validation.

you have the action of the form to post to another page:
<form id="form1" name="form1" method="post" action="gdform.php">

when the form posts, it posts directly to the action page.

all form processing (Including server validation) must occur on the forms action page.

Sign in to reply to this post

elewis93815

Originally Said By: Jason Byrnes
  this is the most common problem with forms and validation.

you have the action of the form to post to another page:
<form id="form1" name="form1" method="post" action="gdform.php">

when the form posts, it posts directly to the action page.

all form processing (Including server validation) must occur on the forms action page.  


Thanks, I swapped the <form id="form1" name="form1" method="post" action="gdform.php"> with <form id="form1" name="form1" method="post" action="contact.php"> and it does error out (which I wanted t to do), however when it errors out it deletes all of the form entry data, is there a way to have it leave the form entry data in place?

Erick

Sign in to reply to this post

Jason ByrnesWebAssist

bind the form elements initial value to the corresponding binding in the Validated Entries collection.

Sign in to reply to this post

p.woodall208922

Still getting problems

Originally Said By: Jason Byrnes
  this is the most common problem with forms and validation.

you have the action of the form to post to another page:
<form id="form1" name="form1" method="post" action="gdform.php">

when the form posts, it posts directly to the action page.

all form processing (Including server validation) must occur on the forms action page.  



Jason it would have been very useful if, in the tutorial, the guide and the UTube video, the fact that validation must be actioned from the page the form is situated upon, had been mentioned. Perhaps this amendment could be made as a matter of urgency to prevent your Clients wasting valuable time.

I have now spent over a week following these guides religously only to note I was clearly wasting my time. Critical facts such as this should NOT be overlooked by WebAssist making the erroneous assumption that the Client will know.

That said for many people, myself included, having the action sent to the page that the form is on is of little use. I have a form which is not actioned on the "form" page at all, but rather via an external form processor and my previous validation method was done from an "onsubmit" action on the page the form lay on.

See contact.php

The form processor, is named formail.php, and is important, as it does many other functions not related to field validation at all. (e.g. redirects to a thank you page upon sucessful submission, checks that the form submitted is a valid submission)

If one is to use Form Toolkit we therefore require a facility to relate it to an onsubmit action - (i.e. Client side validation), on the submitted page, so that both our own form processor AND your field validation can work independantly of each other.

Regards

Peter Woodall

Sign in to reply to this post

Jason ByrnesWebAssist

i you feel that something is missing from the documentation or have any documentation suggestions or feedback, please submit these directly to the documentation team through our feedback form:

feedback.php?type=docs

The main feature of Form Toolkit is captcha. captcha validation cannot be processed client side, it must be processed server side.

the main drawback to client side validation is that it relies on Javascript. the user can get around client side validation by disabling javascript in the browser.

Server side validation cannot be turned off however.

in form toolkit, there is a form data binding tool added to the bindings panel.

this can be used to import form dynamic bindings from the form page to the forms action page enabling you to add the server validation to the action page if it is a different page from the form itself.

you could open you form processing page, then go to the bindings panel, click the plus button and select Form Data. in the form data window, click the folder icon and select the form page.

Form toolkit does not include client side validation, client side validation is included with CSS Form Builder.

Sign in to reply to this post

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