HTML, CSS, and JavaScript Mobile Development For Dummies by William Harrel

HTML, CSS, and JavaScript Mobile Development For Dummies by William Harrel

Author:William Harrel
Language: eng
Format: epub, pdf
Publisher: For Dummies
Published: 2011-08-09T16:00:00+00:00


Select menus and lists use the <select></select> tag pair, and the list options are placed between the <option></option> tag pair, like this.

<select name=”month”>

<option value=”1”>January</option>

<option value=”2”>February</option>

<option value=”3”>March</option>

<option value=”4”>April</option>

<option value=”5”>May</option>

<option value=”6”>June</option>

<option value=”7”>July</option>

<option value=”8”>August</option>

<option value=”9”>September</option>

<option value=”10”>October</option>

<option value=”11”>November</option>

<option value=”12”>December</option>

</select>

The value between the quotation marks is the value this list submits, and the value between the tags is what the user sees. The example just given sets up a drop-down menu. To change from a drop-down to a display list, you simply add the size attribute to the select tag, like this:

<select name=”month” size=”4”>

<option value=”1”>January</option>

<option value=”2”>February</option>

<option value=”3”>March</option>

<option value=”4”>April</option>

<option value=”5”>May</option>

<option value=”6”>June</option>

<option value=”7”>July</option>

<option value=”8”>August</option>

<option value=”9”>September</option>

<option value=”10”>October</option>

<option value=”11”>November</option>

<option value=”12”>December</option>

</select>

The preceding code would create a display list with the first four options displayed, and the remaining options are scrollable. To display the entire list, simply set the size value to number of options. In the above example, the size value would be 12.

Drop-down lists or display lists?

There are several very good reasons for using select lists over text fields. Forcing the user to choose from a list controls how the data gets submitted — and there are all kinds of applications where controlling what the form sends is beneficial. Say, for instance, you're collecting addresses in a database. Forcing the user to choose his state from a list ensures that you don't get a few thousand variations of Mississippi in your database. Using lists to control how dates are sent also saves you from having to sort out umpteen date format versions.

I'm sure you get the idea. There are thousands of ways users can mangle your data collection. Yet another benefit of select lists is that the value sent by the form can be different from what the user selects. Why is this beneficial? Let me give you an example; then, I'm sure, many more reasons will occur to you: Say your company collects customer information based on regions: Southeast, Midwest, and so on. Would you rather your user decides which state falls into what region, or would you rather he or she chooses a state and you — or you select list — decides which region the state is in? For your data collection purposes, North Carolina might be in the Southeast. The person filling out the form may not see it that way. Or maybe you just want to present the user with the names of months, but want them submitted as numbers.

Finally, should you use drop-downs or display lists? This depends on your application and how you want your form to look, of course. If your lists are very long, such as countries or states, for example, the drop-down menu or partial display list saves gobs of screen space — and frankly, they're much more attractive and professional-looking. A rule of thumb I use is: two or three list options go in a display list; more than three go in a drop-down.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Popular ebooks
Whisky: Malt Whiskies of Scotland (Collins Little Books) by dominic roskrow(56008)
What's Done in Darkness by Kayla Perrin(26587)
The Fifty Shades Trilogy & Grey by E L James(19076)
Shot Through the Heart: DI Grace Fisher 2 by Isabelle Grey(19055)
Shot Through the Heart by Mercy Celeste(18933)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 10 by Isuna Hasekura and Jyuu Ayakura(17107)
Python GUI Applications using PyQt5 : The hands-on guide to build apps with Python by Verdugo Leire(16979)
Peren F. Statistics for Business and Economics...Essential Formulas 3ed 2025 by Unknown(16868)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 03 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16815)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 01 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16440)
The Subtle Art of Not Giving a F*ck by Mark Manson(14350)
The 3rd Cycle of the Betrayed Series Collection: Extremely Controversial Historical Thrillers (Betrayed Series Boxed set) by McCray Carolyn(14127)
Stepbrother Stories 2 - 21 Taboo Story Collection (Brother Sister Stepbrother Stepsister Taboo Pseudo Incest Family Virgin Creampie Pregnant Forced Pregnancy Breeding) by Roxi Harding(13615)
Scorched Earth by Nick Kyme(12765)
Drei Generationen auf dem Jakobsweg by Stein Pia(10961)
Suna by Ziefle Pia(10886)
Scythe by Neal Shusterman(10333)
International Relations from the Global South; Worlds of Difference; First Edition by Arlene B. Tickner & Karen Smith(9518)
Successful Proposal Strategies for Small Businesses: Using Knowledge Management ot Win Govenment, Private Sector, and International Contracts 3rd Edition by Robert Frey(9364)
This is Going to Hurt by Adam Kay(9171)