close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Need help with server validation

Thread began 10/08/2009 9:52 pm by Roxana | Last modified 7/12/2010 3:13 pm by Jason Byrnes | 3767 views | 17 replies |

Roxana

Need help with server validation

I would like to add sever validation to the checkout form. I have already added spry validation, but those that have javascript disabled fall through the loops.

I have been looking for a guide or a tutorial, but I couldn't find one. I tried it using the help button, but I couldn't get it to work. My guess is, that I didn't specify the correct server variable.

Could someone help me to get started?

Sign in to reply to this post

Dave BuchholzBeta Tester

Roxana,

you can find the VTK Getting Started Guide and How To's here.

Generally the checkout page submits to the confirm page so open the confirm page in DW and open the bindings panel and find the Form Data Entry open that up and navigate to your checkout page and select it.

You will then have the form values from the checkout page exposed on the confirm page so you can validate them but DON'T FORGET to send the purchaser back to the checkout page if validation fails and display your failure messages there.

Screenshots attached:

Sign in to reply to this post

Roxana

Hi Dave,

Thank you for your reply. I applied the Server Validation behavior to the wrong page. Applying it to the confirm page makes it work. I have set the redirect to the checkout page. Also I applied the Validation Show If behavior to the required fields on the checkout page.

There is a problem though. When I fill out the entire form, and on purpose put in the wrong email format, the entire information is wiped out, and all fields with the Validation Show If behavior show the error message.

Is there a way to retain the information, so that the customer does not have to fill out the form all over again, just because one field was left out?

Sign in to reply to this post

Jason ByrnesWebAssist

On the checkout page, use the Validated entries bindings to set the initial values for the form elements.

Sign in to reply to this post

Roxana

Hi Jason,

Thank you for the tip, the fields now keep their information.

I have applied a validation show if behavior. When one information is entered wrong, it also shows the little error message for the fields, that are filled in correctly. Is there a way to set the behavior up, that the message shows only for those fields, that are not filled in correctly?

Sign in to reply to this post

Roxana

Another thing happened now. The server validation doesn't work anymore. I confirmed the order and put new items in the cart. On the checkout page I did not fill in any information, and despite I am redirected to the confirm page.

Sign in to reply to this post

Roxana

OK, I did get it to work. Don't know what went wrong.

Now all entries are bound to the the Validated Entries. And that works for the text fields. However, it does not work for the drop down menus (state and country). When I make a choice for billingstate and billingcountry and no choice for shippingstate and shippingcountry, I am returned to the checkout page with the error message next to the shipping menu entries. The billing menus are reset to their initial state (no choice), but have no warning next to them. When I leave them like that and fill in the shipping menus, I get returned to checkout page, this time with a warning next to the billing menus and the shipping menus reset .... I hope this is not to complicated.

Do drop down menus need special treatment?

And a general question: Once server validation is in place, is there any reason to keep spry validation?

Sign in to reply to this post

Roxana

There is another problem: When I am on the confirm page and then hit the button to alter entries (in German that button is 'Angaben ändern'), all entries on the checkout page are gone except for the dropdown menus state and country. It used to work, but not anymore. I don't know when that happened, after applying spry validation, after applying server validation or after binding the validated entries.

Here is an overview of my questions:

1. Severvalidation: When I am redirected to the checkout page because of missing entries, how do I get the dropdown menus to keep their value (binding won't keep them)?

2. When I go back from the confirm page to the check out page to alter entries, how do I get the checkout page to keep the values?

3. Once server validation is in place, is there any reason to keep spry validation?

Sign in to reply to this post

Jason ByrnesWebAssist

1 - 2) when you go to the confirm page and use the modify information button, you need to bind the form elements on the checkout page to the session variables that are created. when you fail validation you need to bind to the Validated Entries. one way to get around this is to set the Redirect on validation failure to go back the checkout opage using a querystring value:
checkout.php?valid=false

then use a ternary expression to use either the validated entry or the session variable, for example for the firstname field:

php:
<?php echo((isset($_GET['valid']))?(ValidatedField("confirm","firstname")):isset($_SESSION['eCartCheckoutForm_firstname'])?$_SESSION['eCartCheckoutForm_firstname']:""); ?>



3) you dont need to keep the spry in place. it is really just used as a warning before the form is submitted that it wont pass validation.

Sign in to reply to this post

Roxana

Not working yet

Hi Jason,

I am not sure I understood you. Here is what I did:

- on the confirmpage I changed the failed redirect from checkout.php to checkout.php?valid=false

- on the checkout page I changed the value for the firstname field
from <?php echo(ValidatedField("confirm","firstname")) ?>
to <?php echo((isset($_GET['valid']))?(ValidatedField("confirm","firstname")):isset($_SESSION['eCartCheckoutForm_firstname'])?$_SESSION['eCartCheckoutForm_firstname']:""); ?>

The result is, that at first when validation fails, the value for firstname gets erased. When all field are filled out correctly, the page is validated, and I use the modify button, I am returned to the checkout page with no value in the firstname field. Then, and this is the odd thing, when validation fails again, the value that I entered the first time in the field firstname is returned. And it doesn't matter if I change the firstname, it always returns the name I entered before the first validation failed. Am I making sense?

In a nutshell, it is not working.

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