Студопедия
Случайная страница | ТОМ-1 | ТОМ-2 | ТОМ-3
АвтомобилиАстрономияБиологияГеографияДом и садДругие языкиДругоеИнформатика
ИсторияКультураЛитератураЛогикаМатематикаМедицинаМеталлургияМеханика
ОбразованиеОхрана трудаПедагогикаПолитикаПравоПсихологияРелигияРиторика
СоциологияСпортСтроительствоТехнологияТуризмФизикаФилософияФинансы
ХимияЧерчениеЭкологияЭкономикаЭлектроника

Form Controls and Control Types

Читайте также:
  1. A. Types of Projection
  2. Aggregate Access Control List
  3. Control test
  4. DCDAS (Distributed Control Data Acquisition System) – см.D.C.D.A.S.
  5. ESTABLISHING CONTROLS
  6. Ex. 6.1 Listen to the text and define types of companies.
  7. FEES AND ENROLMENT TYPES

There are a few basic types of form controls that we will introduce immediately and cover in some detail, such as button, checkbox, radio button, label, menu, file select, and text input controls (including password). Beyond these are a few other special-purpose controls— hidden, image, and object controls —which we will be satisfied with merely mentioning: they are beyond the scope of this course. The number of form elements used to create these controls is somewhat smaller. Some elements can create more than one type of control. In fact, the all-purpose INPUT element can be used to create all but the more special-purpose controls—such as menu controls.

 

 

Начало формы

buttons checkboxes radio buttons label
      My label text

 

menus file select text input
single option scrollable options grouped options   single-line input multiple-line input (text area) password

Конец формы

 

Quick facts about controls. Let us now consider a few basic facts about controls in general that makes understanding the nature of each type of control a little easier. First, each control has a control name, which is designated by its name attribute. This control name allows the control to be referred to by other client-side programming entities, such as scripts, and the scope of a control name is the FORM element in which the control resides. But, most important for our current discussion is that the control name plays an important role in the form submission process, which we will say more about shortly.

Second, all controls can have both an initial value and a current value. The initial value (also known as the default value), if one is specified, is designated by the control’s value attribute, though there are a couple of exceptions to this (more about what these exceptions are when we get to discuss the syntax of specific control elements). A control’s initial value never changes. In contrast, the defining characteristic of the current value is that it can be modified. The current value is set to the initial value when the page is first loaded. After that, current values can be modified, by user actions. Of course, when a form is reset, current control values are once again set back to their initial values, where initial values are specified. By the way, controls that have no initial values specified are considered undefined when their current values have not been modified—either after the form is first loaded or after it is reset. Controls that remain undefined cannot be sent with a form to a server. But, the term undefined may carry connotations that don't apply here, so let's probe into what it means in this context, and as we do, be aware that the phrase "remain undefined" in the preceeding sentence is an important one and was used deliberately. Undefined is used to describe situations for which no standard has been defined about how user agents (browsers, for example) are to behave in those situations; therefore, how browsers handle (or don't handle) those types of situations may vary from browser to browser. For example, some browsers when they process forms and encounter certain types of controls that have no current or assigned initial (default) values might assign default values on their own (such as an empty string when a string data is called for) and then include controls and values in the data set to be sent to the server. Other browsers might ignore the controls and exclude them from form data sets. The important point to remember here is that undefined means you can't predict browser behavior, and, as a developer of Web page, that is something you want to avoid.

Finally, when a form is submitted for processing, the controls that have values (including those with browser-assigned default values) have their names and values combined into name-value pairs, which are then submitted to a server with the form. All controls submitted with a form, are known as successful controls; as mentioned before, controls that remain undefined are not considered successful controls, and are not sent to a server. But, like the word undefined, the words successful and unsuccessful carry certain connotations that do not necessarily apply here. Unsuccessful controls are merely controls that, for whatever reason, do not qualify to be included in a data set sent to a server, and that isn't necessarily a bad thing. Why should controls be sent to the server if there are no values to submit with them?


Дата добавления: 2015-07-26; просмотров: 162 | Нарушение авторских прав


<== предыдущая страница | следующая страница ==>
The FORM Element| The INPUT Element

mybiblioteka.su - 2015-2024 год. (0.005 сек.)