SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Taunton, UK
    Posts
    787
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hiding elements of a form that may not be necessary

    I am creating a registration type form which is quite long and I was thinking of hiding certain sections of it that are only relevant to certain registrants.

    For example, there is a set of radio boxes asking if the user would like to add the details of their car.

    If they select the "yes" radio button then I was going to display a section of the form with the relevant fields to fill in with the details of their car.

    Are there any accessible / usability issues with this approach?

    To hide / display the additional form elements I was going to use code like the following:

    Code:
    <script type="text/javascript">
    function showTextBox(carDetailsYesNo) {
       if (carDetailsYesNo.value == "Yes" ) {
          document.getElementById("carDetailBox").style.display = "block";
       } else {
          document.getElementById("carDetailBox").style.display = "none";
       }
    }
    </script>
    Mediakitchen Limited
    App Development | Website Design & Development | Flash Game Development
    Somerset, UK
    http://www.mediakitchen.co.uk

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As long as everything is visible by default, and you use unobtrusive JavaScript that adds this feature if supported/enabled, then there shouldn't be any major problems.

    Users with some types of cognitive disabilities may be confused, and users with screen magnifiers may not perceive the change, but they may not be the primary target audience for a car-related site.
    Birnam wood is come to Dunsinane

  3. #3
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you disable scripting, then the form elements will be visible by default, whcih can cause some confusion among those who don't have scripting enabled. A better alternative might be to use a server-side programming language to custom build the form as a series of pages customized specifically for them (a sessioN ID or cookie-based session might come in really handy here).

    Edit:

    Gah, Tommy's right. That's what I get for posting right after I wake up. Never mind.

  4. #4
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Taunton, UK
    Posts
    787
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks guys for the advice. I may therefore consider breaking the form up into separate sections instead and ensuring everything is visible at all times.

    I still have the scenario where dealing with different countries, the address form fields need to be country specific. E.g for UK it would use Counties and Postcodes, and the US would use States and Zip Codes. Not sure what the best way to deal with this kind of scenario is with regards accessibility and usability?!
    Mediakitchen Limited
    App Development | Website Design & Development | Flash Game Development
    Somerset, UK
    http://www.mediakitchen.co.uk

  5. #5
    SitePoint Wizard bronze trophy C. Ankerstjerne's Avatar
    Join Date
    Jan 2004
    Location
    The Kingdom of Denmark
    Posts
    2,702
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    You might be able to find a database of address field information, but it will most likely be incorrect (almost all the ones I've seen have had critical errors, basically preventing me from registering unless I make up fake address elements), so you will have to check it anyway. Therefore, your best option is to either research it yourself, or use a TEXTAREA for the address information for those countries for any country where you do not know every intricate detail of the country's address formats and regulations.
    Christian Ankerstjerne
    <p<strong<abbr/HTML/ 4 teh win</>
    <>In Soviet Russia, website codes you!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •