Archive for September, 2007

Web hosting faq - 591Chapter 26 .Select, Option, and FileUpload Objects of

Sunday, September 30th, 2007

591Chapter 26 .Select, Option, and FileUpload Objects of the entire SELECT object. To get the displayed text of the selected option, however, you must zero in further to extract the text property of a single option among all options defined for the object. When you define a SELECT object within a form, the construction of the tag pair is easy to inadvertently mess up. First, most attributes that define the entire object such as NAME, SIZE, and event handlers are attributes of the opening tag are additional tags for each option to be displayed in the list. The following object definition creates a selection pop-up list containing three color choices:

The indented formatting of the tags in the HTML document is not critical. I indent the lines of options merely for the sake of readability. By default, a SELECT element is rendered as a pop-up list. To make it appear as a scrolled list, assign an integer value greater than 1 to the SIZE attribute to specify how many options should be visible in the list without scrolling how tall the list s box should be, measured in lines. Because scrollbars in GUI environments tend to require a fair amount of space to display a minimum set of clickable areas (including sliding thumbs ), you should set list-box style sizes to no less than 4. If that makes the list box too tall for your page design, consider using a pop-up menu instead. Significant differences exist in the way each GUI platform presents pop-up menus. Because each browser sometimes relies on the operating system to display its native pop-up menu style (and sometimes the browser designers go their own way), considerable differences exist among the OS and browser platforms in the size of a given pop-up menu. What fits nicely within a standard window width of one OS may not fit in the window of another OS in a different browser. In other words, you cannot rely on any SELECT object having a precise dimension on a page (in case you re trying to align a SELECT object with an image). In list-box form, you can set a SELECT object to accept multiple, noncontiguous selections. Users typically accomplish such selections by holding down a modifier key (the Shift, Ctrl, or key, depending on the operating system) while clicking additional options. To switch on this capability for a SELECT object, include the MULTIPLE attribute constant in the definition. For each entry in a list, your elements of a form, a TEXTAREA object is indeed a form input element, providing multiple-line text input facilities. Although some browsers let you put a TEXTAREA element anywhere in a document, it really should be contained by a FORM element. A TEXTAREA object closely resembles a text object, except for attributes that define its physical appearance on the page. Because the intended use of a TEXTAREA object is for multiple-line text input, the attributes include specifications for height (number of rows) and width (number of columns in the monospaced font). No matter what size you specify, the browser displays a textarea with horizontal and vertical scrollbars in older browsers; more recent browsers tend to be smarter about displaying scrollbars only when needed (although there are exceptions). Text entered in the textarea wraps within the visible rectangle of the field if you set the WRAP attribute to virtual or physical in NN and soft or hardin IE; otherwise the text scrolls for a significant distance horizontally (the horizontal scrollbar appears when wrapping has the default off setting). This field is, indeed, a primitive text field by GUI computing standards in that font specifications made possible in newer browsers by way of style sheets apply to all text in the box. All properties, methods, and event handlers of text objects apply to the TEXTAREA object. They all behave exactly the same way (except, of course, for the type property, which is textarea). Therefore, refer to the previous listings for the text object for scripting details for those items. Discussed next are a handful of additional properties that are unique to the TEXTAREA object. TEXTAREA
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.

583Chapter 25 .Text-Related Form Objects Syntax See Text (Professional web hosting)

Thursday, September 27th, 2007

583Chapter 25 .Text-Related Form Objects Syntax See Text Input Object. About this object A hidden object is a simple string holder within a form object whose contents are not visible to the user of your Web page. Despite the long list of properties, methods, and event handlers that this input element type inherits by virtue of being an input element, you will be doing little with a hidden element beyond read ing and writing its value property. The hidden object plays a vital role in applications that rely on CGI programs on the server. Very often, the server has data that it needs to convey to itself the next time the client makes a submission (for example, a user ID captured at the applica tion s login page). A CGI program can generate an HTML page with the necessary data hidden from the user but located in a field transmitted to the server at submit time. Along the same lines, a page for a server application may present a user-friendly interface that makes data-entry easy for the user. But on the server end, the database or other application requires that the data be in a more esoteric format. A script located in the page generated for the user can use the onSubmitevent han dler to perform the last minute assembly of user-friendly data into database- friendly data in a hidden field. When the CGI program receives the request from the client, it passes along the hidden field value to the database. I am not a fan of the hidden object for use on client-side-only JavaScript applica tions. If I want to deliver with my JavaScript-enabled pages some default data col lections or values, I do so in JavaScript variables and arrays as part of the script. Because scripted changes to the contents of a hidden field are fragile (for exam ple, a soft reload erases the changes), the only place you should consider making such changes is in the same script that submits a form to a CGI program or in a function triggered by an onSubmit event handler. In effect, you re just using the hid den fields as holding pens for the scripted data to be submitted. For more persis tent storage, use the document.cookie property or genuine text fields in hidden frames, even if just for the duration of the visit to the page. For information about the properties of the hidden object, consult the earlier listing for the text input object. The typeproperty for this object returns hidden. TEXTAREA Element Object For HTML element properties, methods, and event handlers, see Chapter 15. Properties Methods Event Handlers cols createTextRange() onAfterUpdate form select() onBeforeUpdate name onChange readOnly onErrorUpdate Continued TEXTAREA
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

582 Part III . Document Objects Reference On

Thursday, September 27th, 2007

582 Part III . Document Objects Reference On the CD-ROM Note In NN4 (only), if you have both onChange and any keyboard event handlers defined for the same text field tag, the onChange event handlers are ignored. This is not true for IE4, where all events fire. Example (with Listing 25-6) on the CD-ROM Password Input Object Properties Methods Event Handlers See Text Input Object Syntax See Text Input Object. About this object A password-style field looks like a text object, but when the user types some thing into the field, only asterisks or bullets (depending on your operating system) appear in the field. For the sake of security, any password exchanges should be handled by a server-side CGI program. Many properties of the password object were blocked from scripted access in NN2. Scripts in later browsers can treat a password object exactly like a text INPUT object. This may lead a scripter to capture a user s Web site password for storage in the document.cookieof the client machine. A password object value property is returned in plain language, so that such a captured password would be stored in the cookie file the same way. Because a client machine s cookie file can be exam ined on the local computer (perhaps by a snoop during lunch hour), plain-language storage of passwords is a potential security risk. Instead, develop a scripted encryption algorithm for your page for reading and writing the password in the cookie. Most password-protected sites, however, usually have a CGI program on the server encrypt the password prior to sending it back to the cookie. See the text object discussion for the behavior of password object s properties, methods, and event handlers. The typeproperty for this object returns password. Hidden Input Object Properties Methods Event Handlers See Text Input Object document.formObject.hiddenObject
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.

581Chapter 25 .Text-Related Form Objects one of these (Affordable web design)

Wednesday, September 26th, 2007

581Chapter 25 .Text-Related Form Objects one of these three event handlers in a text object. Because some events cannot occur without triggering others either immediately before or after (for example, an onFocus occurs immediately before an onSelectif the field did not have focus before), whatever actions you script for these events should be as distinct as possible to avoid interference or overlap. Note The onSelect event handler does not work in Windows versions of NN at least through Version 4. In particular, be careful about displaying modal dialog boxes (for example, window.alert() dialog boxes) in response to the onFocusevent handler. Because the text field loses focus when the alert displays and then regains focus after the alert is closed, you can get yourself into a loop that is difficult to break out of. If you get trapped in this manner, try the keyboard shortcut for reloading the page (Ctrl+R or -R) repeatedly as you keep closing the dialog box window. A question often arises about whether data-entry validation should be triggered by the onBluror onChangeevent handler. An onBlurvalidation cannot be fooled, whereas an onChangeone can be (the user simply doesn t change the bad entry as he or she tabs out of the field). What I don t like about the onBlurway is it can cause a frustrating experience for a user who wants to tab through a field now and come back to it later (assuming your validation requires data be entered into the field before submission). As in Chapter 43 s discussion about form data validation, I recommend using onChangeevent handlers to trigger immediate data checking and then using another last-minute check in a function called by the form s onSubmit event handler. On the CD-ROM Example (with Listing 25-5) on the CD-ROM onChange NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility . . . Of all the event handlers for a text object, you will probably use the onChange handler the most in your forms (see Listing 25-6). This event is the one I prefer for triggering the validation of whatever entry the user just typed in the field. The potential hazard of trying to do only a batch-mode data validation of all entries before submitting an entire form is that the user s mental focus is away from the entry of a given field as well. When you immediately validate an entry, the user is already thinking about the information category in question. See Chapter 43 for more about data-entry validation. document.formObject.textObject.onChange
Check Tomcat Web Hosting services for best quality webspace to host your web application.