close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dropdown server validation

Thread began 6/02/2012 4:30 am by steve204795 | Last modified 6/05/2012 9:33 am by Jason Byrnes | 1962 views | 8 replies |

steve204795

Dropdown server validation

Hi.. I went thru the steps of validating adropdown for checkout.php & confirm.php and all choices result in being rejected back to the checkout page .. How do I make only the null choice the one to be rejected

Sign in to reply to this post

Jason ByrnesWebAssist

make sure the option does not have a value:

<option value="">Make a selection</option

and use the required not blank validation type.

Sign in to reply to this post

steve204795

whcih server variable

ok ... onw more question, do i choose an existing variable from Server Variables or do I create and name my own variable

Sign in to reply to this post

Jason ByrnesWebAssist

click the lightning bolt icon and chose the select list form element from the dynamic bindings.

Sign in to reply to this post

steve204795

code snippet

here's the code generated by the WA behaviors...

<select name="Ship_Type" id="Ship_Type">
<option value="" selected="selected" <?php if (!(strcmp("", $_SERVER['ShipType']))) {echo "selected=\"selected\"";} ?>>Shipping Options</option><option value="1" <?php if (!(strcmp(1, $_SERVER['ShipType']))) {echo "selected=\"selected\"";} ?>>UPS Ground</option>
<option value="2" <?php if (!(strcmp(2, $_SERVER['ShipType']))) {echo "selected=\"selected\"";} ?>>USPS Priority</option>
<option value="3" <?php if (!(strcmp(3, $_SERVER['ShipType']))) {echo "selected=\"selected\"";} ?>>USPS Express Mail</option>
<option value="4" <?php if (!(strcmp(4, $_SERVER['ShipType']))) {echo "selected=\"selected\"";} ?>>USPS 1st Class Mail</option>
<option value="5" <?php if (!(strcmp(5, $_SERVER['ShipType']))) {echo "selected=\"selected\"";} ?>>International Express</option>
<option value="6" <?php if (!(strcmp(6, $_SERVER['ShipType']))) {echo "selected=\"selected\"";} ?>>International Priority</option>

</select>
<?php
if (ValidatedField('confirm_136','confirm_136')) {
if ((strpos((",".ValidatedField("confirm_136","confirm_136").","), "," . "1" . ",") !== false || "1" == "")) {
if (!((strpos((",".ValidatedField("confirm_136","confirm_136").","), "," . "1" . ",") !== false || "1" == ""))) {
?>
<span class="red"> PLEASE CHOOSE SHIPPING METHOD </span>
<?php //WAFV_Conditional confirm.php confirm_136(1:1)
}
}
}?>

Sign in to reply to this post

Jason ByrnesWebAssist

I dont understand what the question is.

please provide more details.

Sign in to reply to this post

steve204795

validation steps

HI Jason .. below is a summary of the steps i took ..

- on the confirm.php page - added Data Form binding to checkout.php
- created a server validation name of ShipType - with a failed redirect of checkout.php ( is this what i need to do or do i choose one of the pre-existing server validations like HTTP Accept ?)
- added a validation show if msg on checkout.php if they do not choose a ship type
- selected the dropdown form element and clicked lightning bolt and bound to my server validation ShipType

result: all choices force you back to checkout.php and the msg doesn't show

toydb_for_sale2.php

Thanks ..

Sign in to reply to this post

steve204795

code removed

Hi Jason .. Ray helped me with a USPS issue so i had to remove the code to test - can you just validate that my steps in the last post were correct and I will try it again ... thanks

Sign in to reply to this post

Jason ByrnesWebAssist

all correct except:


- created a server validation name of ShipType - with a failed redirect of checkout.php ( is this what i need to do or do i choose one of the pre-existing server validations like HTTP Accept ?)


in the server validation behavior, select the Required / not blank validation type.

for the server variable, click the lightning bolt icon and select the Ship Type select list, then click the plus button to add the validation to the list.

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