close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Server Validation Checkout Page - Retain Int Vals

Thread began 7/07/2010 9:19 am by dlovas275157 | Last modified 7/09/2010 2:08 pm by Jimmy Wu | 2524 views | 6 replies |

dlovas275157

Server Validation Checkout Page - Retain Int Vals

I do not require my shopper to login. Therefore there are 2 scenarios:

1. Logged in user when checkout page loads, filed are populated with init vals from rsUser.
If validation fails, init val reloads the value from rsUser

2. If user is not logged in, I want to set init value to the validated entry of the form when it is submitted. But the code is already set to rsUser field.

Is there a way to set the init value to "rsUser value", then if that is empty set it to the "validated entry field"?

Sign in to reply to this post

Jimmy Wu

One way you can check this is to use the simplified if then else notation that looks like this:
<conditional statement>?<if condition is true>:<if condition is false>

So you would want to set the value of the form field to equal that statement. For example (in pseudocode):
value=rsUser value existst?rsUser value:$_POST[form field name];

You might want to check if the post value is set on the form so something like this:
value=rsUser value existst?rsUser value: (isset($_POST[form field name])?$_POST[form field name]:"");

Sign in to reply to this post

dlovas275157

Jimmy,

Thanks for your response. Im having a little trouble understanding how to structure the shorthand if/then/else within a value=""

Currently i have either below (loads init val from the registered users profile)

value="<?php echo $row_rsUser['firstName']; ?>"

or (loads from validated entries rs on page reload)

value="<?php echo(ValidatedField("confirm_386","firstName")) ?>"

I'm attempting to combine the two into an if/then:

Based on your instructions
<conditional statement>?<if condition is true>:<if condition is false>

value="<?php if ( $row_rsUser['firstName'] != )?>?<?php echo $row_rsUser['firstName']; ?>:<?php echo(ValidatedField("confirm_386","firstName")) ?>"

Is that correct?

Sign in to reply to this post

dlovas275157

I cannot get it to work with my interpretation above. Could you advise on fixing my code. Thanks. D

Sign in to reply to this post

Jimmy Wu

You would want to check if the validated field value exists first:
(ValidatedField("confirm_386","firstName") != "")

If it is set then you want to use the value, if it isn't you want to use the value from the users registered profile:
<?php echo ((ValidatedField("confirm_386","firstName") != "")?ValidatedField("confirm_386","firstName"):$row_rsUser['firstName']) ?>

Sign in to reply to this post

dlovas275157

Jimmy,

Thanks for your help. I understand the shorthand if/then now.

value="<?php echo ((ValidatedField("confirm_386","firstname") != "")?ValidatedField("confirm_386","firstname"):$row_rsUser['firstName']) ?>"

The above worked. I had to make the firstName -> firstname in both places that pulled from validated fields. They used lowercase n.

This sets the init val to (1) the entered value if the text field had an entered value when submitted, then (2) rsUser -> firstName

This helps retain logged in user's data when they are logged in (optional login, not required).

Works great. Thanks again.

D.

Sign in to reply to this post

Jimmy Wu

Great to hear it. If you run into any additional issues, feel free to open a new thread.

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