View on GitHub

reading-notes

https://samahabujwaied.github.io/reading-notes/

Forms

Why Forms?

The best known form on the web is probably the search box that sits right in the middle of Google’s homepage. In addition to enabling users to search, forms also allow users to perform other functions online. You will see forms when registering as a member of a website, when shopping online, and when signing up for newsletters or mailing lists.

Form Controls

How forms work

  1. A user fills in a form and then presses a button to submit the information to the server.
  2. The name of each form control is sent to the server along with the value the user enters or selects.
  3. The server processes the information using a programming language such as PHP, C#, VB.net, or Java. It may also store the information in a database. 4.The server creates a new page to send back to the browser based on the information received.

Form structure

Text input

Password input

Text area

Radio button

Checkbox

Submit button

Image button

html5: Form Validation

You have probably seen forms on the web that give users messages if the form control has not been filled in correctly; this is known as form validation.Traditionally, form validation has been performed using JavaScript (which is beyond the scope of this book). But HTML5 is introducing validation and leaving the work to the browser.

html5: data input

<input>Many forms need to gather information such as dates, email addresses, and URLs. This has traditionally been done using text inputs. type=”date”If you are asking the user for a date, you can use an <input> element and give the type attribute a value of date.This will create a date input in browsers that support the new HMTL5 input types.

Lists, tables and Forms

  1. Bullet point styles
  2. images for bullets
  3. positioning the marker
  4. list shorthand
  5. table properties
  6. borderon empty cells
  7. GAOs between cells

Styling submit buttons

styling fieldsets & Legends

Aligning form controls : problem

Aligning form controls : solution

Cursor styles

Events in JS

HOW EVENTS TRIGGER JAVASCRIPT CODE

HTML EVENT HANDLER ATTRIBUTES (DO NOT USE)

TRADITIONAL DOM EVENT HANDLERS

USING DOM EVENT HANDLERS

USING PARAMETERS WITH EVENT LISTENERS

USING EVENT LISTENERS WITH THE EVENT OBJECT