...

View Full Version : How can I make my drop down choice mandatory (forms)?



zachmedia
12-27-2006, 03:01 AM
Hey,
I've scourged the internet but haven't found anything about this question: How did I make it mandatory for users to choose an option from a dropdown menu?
the site: http://turfmaster.cc/pay_pal.html

I want users to able to select either Orlando or Tampa before being allowed to click on the PayPal button...Possible?

Attached is my coding, as I am trying to do it for a website. I know very little about JavaScript so any help would be hot.

Much appreciated,
Zachary:thumbsup:

TripperTreats
12-27-2006, 11:00 AM
make the paypal button disabled, as in:

<input type="button" disabled="disabled"........

After a user chooses an option, have the onclick handler enable the button:

<select onclick="PayPalButton.disabled=''" .......

After the equal sign that's two apostrophes, ' '(without the space in between), and then the closing quotation mark ".

nikkiH
12-27-2006, 03:33 PM
While javascript is a great solution for many things, mandatory validation is not one of them. While many internet users are not technically inclined, just as many are, and will quickly clue into a simple solution that can be typed into the URL bar to bypass any javascript validation if they've a mind to. Javascript validation is a nice thing to use in addition to server-side validation, to save the users' time (and server bandwidth) if they happen to have script enabled. It should never be relied upon as the only validation.

It also breaks the form for disabled users who use text-to-speech browsers. Breaking things for disabled users is illegal in the UK and is iffy here in the States if it is a commercial website (ADA).

A compliant option would be to have an intermediate server-side form that does the validation and redirects to Paypal upon success. You could use this in addition to client-side script if you like.

Or you could just not have a blank option at all. If it isn't valid to have no selection, why have a "select region" blank option at all? Radio buttons are another option if you've only got a few choices, with one default selected.

TripperTreats
12-27-2006, 07:58 PM
Excellent discussion nikkiH, thank you for the info. I had no idea that it was illegal in the UK; that's interesting.

nikkiH
12-27-2006, 09:07 PM
The States are starting to require more along that line as well, and IIRC there was actually a lawsuit against a commercial company a couple months ago. Not 100% certain on that; I just remember hearing something about it.

(It's the ADA in the States, the DDA in the UK, and both are more about discrimination than usability per se.)

Not everyone follows the rules, of course, but from what I gather from other boards, it is more vigorously enforced in the UK. This is hearsay, so I won't say I'm certain on that. I know it comes up more often on the boards I go to where there are more non-US posters.

Here are a few links on the subject.

US: http://www.ada.gov/websites2.htm
Mostly US-centric, links to tips as well: http://websitetips.com/accessibility/
UK article:
http://www.bytestart.co.uk/content/legal/35_1/web-site-legal-requirements.shtml
UK: http://www.web-accessibility.co.uk/legal.asp



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum