close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Is it possible to add Server Validation to the Search Results page

Thread began 7/27/2011 5:09 pm by georgevargasa302189 | Last modified 7/29/2011 3:34 pm by Jason Byrnes | 8335 views | 7 replies |

georgevargasa302189

Is it possible to add Server Validation to the Search Results page

I have a DataAssist Results page with a Search form on it, and I want to validate search values such as phone number.

Client Validation does not work, so is there a way to use Server validation since the page uses Get and not Post.

Sign in to reply to this post

Jason ByrnesWebAssist

you would need to add URL Variables for each form element, including the submit button to the bindings panel.

go to the bindings panel, click the plus button and select "URL Variable"

Use the form element name for the URL Variable name, repeat this for each form element you wish to validate, including the submit button.

NOTE: PHP is case sensitive. when adding the URL Variable bindings make sure to use the same case as the form elements names.


Once the URL Variables are created, you can use them as the Server Variables in the Server Validation behavior.

for the trigger, click the lightning bolt and select the submit button URL Variable binding

Sign in to reply to this post

georgevargasa302189

Thank you.

I tried it and if I enter in a bad phone value I get the following message. I suspect the page keeps getting called over and over when there is an error.

This webpage has a redirect loop
The webpage at orders_Results.php?S_OrderID=&S_OrderDate=&S_OrderDate_2=&S_OrderEmail=&S_OrderShipName=&S_OrderPhone=805&Search.x=36&Search.y=12&Search=Search has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.

This is the server validation, I tried using Search.X with the same results.

<?php
if (($_GET['Search'] != "")) {
$WAFV_Redirect = "orders_Results.php";
$_SESSION['WAVT_ordersResults_500_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidatePN($_GET['S_OrderPhone'] . "",false,true,false,5);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"ordersResults_500");
}
}
?>

Sign in to reply to this post

Jason ByrnesWebAssist

Change this code:

php:
if ($WAFV_Errors != "") {

PostResult($WAFV_Redirect,$WAFV_Errors,"ordersResu lts_500");
}





to:

php:
if ($WAFV_Errors != "") {

if(isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "") {
        // array of QS variable names to remove //   
        $arrRemove = array();
        $arrRemove[] = "Search";
        $arrRemove[] = "Search_x";
        $arrRemove[] = "Search_y";
        $arrRemove[] = "Search.x";
        $arrRemove[] = "Search.y";

        
        $arrQS = explode("&", $_SERVER["QUERY_STRING"]);
        foreach($arrQS as $k => $v) {
            $arrVar = explode("=", $v);
            if(in_array($arrVar[0], $arrRemove)) unset($arrQS[$k]);
        }
        if(sizeof($arrQS) > 0) {
            $_SERVER["QUERY_STRING"] = "?".implode("&", $arrQS);
        } 
}            
PostResult($WAFV_Redirect,$WAFV_Errors,"ordersResu lts_500");
}
Sign in to reply to this post

georgevargasa302189

Thank you that worked great!!!

Now the only issue is if create an error, it displays that show if error even if I do another search without errors.

What do I add to clear the server errors, once I hit the search button again?

Sign in to reply to this post

Jason ByrnesWebAssist

add the following code after the </html> tag:

php:
<?php if(isset($_SESSION['WAVT_ordersResults_500_Errors'])) unset($_SESSION['WAVT_ordersResults_500_Errors']); ?>
Sign in to reply to this post

georgevargasa302189

Thank you for all your help!

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

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