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

Priority - validated vs session variable?

Thread began 6/20/2012 10:49 am by msummers194171 | Last modified 6/21/2012 11:41 am by Jason Byrnes | 981 views | 9 replies |

msummers194171

Priority - validated vs session variable?

On my eCart4 site, the checkout page leads to the confirmation page (as usual). In my case, the fields on the checkout page look like this -

<td><input type="text" name="firstname" id="firstname" value="<?php echo(ValidatedField("confirm","firstname")) ?>" /></td>

When you then click on the CHECKOUT button on the checkout page, you are taken to the confirm.php page where session variables are loaded containing the POSTed data. If you want to make a modification to the cart's contents, and click on the MODIFY button (which returns you to the checkout page with a javascript backup in the history), the fields are blank. I'd like to populate those fields with the originally posted data. How should the modified fields look to do that? Should I give priority to the session variables or to the validated field data?

Thanks!

Sign in to reply to this post

Jason ByrnesWebAssist

the validated entries will only be set if the form fails validation.

In the validation server behaviors, set the failed redirect to go back to the checkout page and pass "failed=true" as a querystring variable:
checkout.php?failed=true

and use a ternary expresion to use the validated entries based on the query srting:

php:
value="<?php echo((isset($_GET['failed']))?(ValidatedField("confirm","firstname")):(isset($_SESSION['eCartCheckoutForm_firstname'])?$_SESSION['eCartCheckoutForm_firstname']:"")); ?>"
Sign in to reply to this post

msummers194171

Jason, thanks. Can you recommend what to do for the <select> tags? They currently have something like this -

<?php if (!(strcmp("MasterCard", (ValidatedField("confirm","cc_type"))))) {echo "selected=\"selected\"";} ?>

Sign in to reply to this post

Jason ByrnesWebAssist

for a select list, click the dynamic button in the property inspector, and use the following code for the Select Value Equal To option:

php:
<?php ((isset($_GET['failed']))?(ValidatedField("confirm","cc_type")):(isset($_SESSION['eCartCheckoutForm_cc_type'])?$_SESSION['eCartCheckoutForm_cc_type']:"")) ?>
Sign in to reply to this post

msummers194171

So, it would be -

<?php if(((isset($_GET['failed']))?(ValidatedField("confirm","cc_type")):(isset($_SESSION['eCartCheckoutForm_cc_type'])?$_SESSION['eCartCheckoutForm_cc_type']:""))) { echo 'selected="selected"'; } ?>

is that right?

Sign in to reply to this post

Jason ByrnesWebAssist

no, that doesnt look right.

dont edit the code directly, use the dynamic button in the property inspector, and input the code i gave for the select value equal to option, let dreamweaver generate the code for each option.

Sign in to reply to this post

msummers194171

But I'm doing this on a box that doesn't have the extension installed. :(

Sign in to reply to this post

Jason ByrnesWebAssist

doesn't mater if the extension is installed, the code I gave will do the trick if you paste it to the Select Value equal To section in the Select Lists Dynamic Properties.

Sign in to reply to this post

msummers194171

Thanks - looks like that works. Here's a head-up for you. You can update <select> tags as you describe, BUT if the <select> tag contains an <optgroup>, the updating will stop at that tag and ignore the rest of the <option> tags within that <select>. If you want to do the full <select> tag, you will have to remove the <optgroup> tags first and then replace them.

Sign in to reply to this post

Jason ByrnesWebAssist

Yes, the Dreamweaver interface does not have support for optgroups, so wont recognize them.

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