Web Technologies and Programming Lecture 10

HTML5 added the following attributes for : autocomplete autofocus form formaction formenctype formmethod formnovalidate formtarget height and width list min and max multiple pattern (regexp) placeholder required

pptx52 trang | Chia sẻ: hoant3298 | Lượt xem: 492 | Lượt tải: 0download
Bạn đang xem trước 20 trang tài liệu Web Technologies and Programming Lecture 10, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
1Web Technologies and ProgrammingLecture 10 2HTML FORMS3Summary of the previous lecture4Creating tables in HTMLTable attributesTable level attributesRow level attributesCell level attributesPage lay-out using tablesOutlineHTML FORMSHTML FORM elements51. HTML FORMSHTML forms are used to collect user input.HTML forms contain form elements.Form elements are different types of input elements, checkboxes, radio buttons, submit buttons, and more.61. HTML FORMSThe  element defines an HTML form: . form elements . 71. HTML FORMSForms provide a means of submitting information from the client to the serverHTML supports tags for creating forms, however, it does not process the informationUse server-side script to process form informationServer-side script runs on the Web server and receives data from a form and uses it to perform a set of tasks8This figure shows how a Web page form interacts with a CGI script. 1. HTML FORMS91. HTML FORMS tag is used to start a form tag is used to end a formBetween and , form elements are placedWe can declare a form as: form elements and layout tags A single page can include several different forms, but you cannot nest one form inside another101. HTML FORMSCommon Form Attributes:action - gives the URL of the application that is to receive and process the forms datamethod - sets the HTTP method that the browser uses to send the form's data to the server for processing; Either POST or GETname – name of the form111. HTML FORMSWhen to Use GET?You can use GET (the default method):If the form submission is passive (like a search engine query), and without sensitive information.When you use GET, the form data will be visible in the page address.121. HTML FORMSWhen to Use POST?You should use POST:If the form is updating data, or includes sensitive information (password).POST offers better security because the submitted data is not visible in the page address.131. HTML FORMSGET Requests data from a specified resourceGET requests can be cachedGET requests remain in the browser historyGET requests can be bookmarkedGET requests should never be used when dealing with sensitive dataGET requests have length restrictionsGET requests should be used only to retrieve data141. HTML FORMSPOST Submits data to be processed to a specified resourcePOST requests are never cachedPOST requests do not remain in the browser historyPOST requests cannot be bookmarkedPOST requests have no restrictions on data length152. Form ElementsTextbox Password FieldHidden FieldCheckboxRadio ButtonText AreaSelect ListSubmit ButtonReset Button162.1 Text boxNAMESIZEVALUEMAXLENGTH172.1 Text box defines a button for submitting a form to a form-handler.The form-handler is typically a server page with a script for processing input data.182.1 Text box19Start of the formlabelText box2.1 Text box20labelText boxvalue2.2 Password Field NAMESIZEVALUEMAXLENGTHNote: The characters in a password field are masked (shown as asterisks or circles).212.2 Password Field22Type is password2.2 Password Field23Typed characters are hidden2.3 Hidden Text FieldNAMEVALUE242.3 Hidden Text Field25Type is hidden2.3 Hidden Text Field26Hidden field is not visible2.4 CheckboxCHECKEDNAMEVALUECheckboxes let a user select ZERO or MORE options of a limited number of choices.272.4 Checkbox28labeloptionTypecheckedvalue2.4 Checkbox29labelOptionsAlready checked2.5 Radio ButtonsCHECKEDNAMEVALUEMALEFEMALERadio buttons let a user select ONLY ONE of a limited number of choices:302.5 Radio Buttons31labelOptiontypeSame name2.5 Radio Buttons32Radio ButtonAlready checked2.6 Select listDrop down list:Select Name, sizeOptionLAHOREKARACHISLAMABAD332.6 Select list34List startsoptionsSelect ends2.6 Select list35Select list with options2.6.1 Creating scrolling select listTo create scrolling select list, we use the size attribute of the The value of the size attribute is the number of options you want to be visible at any one time362.6.1 Creating scrolling select list37Size attribute2.6.1 Creating scrolling select list38Visible OptionsScrolling Option2.7 Text areaText-areaThe  element defines a multi-line input field (a text area):RowsCols Name Default text 392.7 Text area402.7 Text area41Text area2.8 File fieldFile-field422.8 File field432.8 File field442.9 Submit and Reset buttonsSubmit and Reset Buttons defines a button for submitting form input to a form-handler.The form-handler is typically a server page with a script for processing input data.452.9 Submit and Reset buttons46Submit buttonReset button2.9 Submit and Reset buttons47SubmitResetSummary48HTML5 added several new input types:colordateDatetimeemailmonthnumberrangesearchteltimeurlweekSummary - input49HTML5 added the following attributes for :autocompleteautofocusformformactionformenctypeformmethodformnovalidateformtargetheight and widthlistmin and maxmultiplepattern (regexp)placeholderrequiredSummary - attributes for input50HTML5 added the following attributes for :the following attributes for :autocompletenovalidateSummary51Creating forms in HTMLAdding form elementsTHANK YOU52

Các file đính kèm theo tài liệu này:

  • pptxlecture_10_wt_html_forms_5466_2028572.pptx
Tài liệu liên quan