Forms, Validation Week 7 INFM 603. Announcements Try placing today’s example in htdocs (XAMPP). This will allow you to execute examples that rely on PHP.

Slides:



Advertisements
Similar presentations
HTML Forms. collect information for passing to server- side processes built up from standard widgets –text-input, radio buttons, check boxes, option lists,
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
23-Aug-14 HTML/XHTML Forms. 2 What are forms? is just another kind of XHTML/HTML tag Forms are used to create (rather primitive) GUIs on Web pages Usually.
24-Aug-14 HTML Forms. 2 What are forms? is just another kind of HTML tag HTML forms are used to create (rather primitive) GUIs on Web pages Usually the.
JavaScript Forms Form Validation Cookies. What JavaScript can do  Control document appearance and content  Control the browser  Interact with user.
Video, audio, embed, iframe, HTML Form
SE-2840 Dr. Mark L. Hornick 1 HTML input elements and forms.
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
JavaScript Forms Form Validation Cookies CGI Programs.
Creating Web Page Forms. Objectives Describe how Web forms can interact with a server-based program Insert a form into a Web page Create and format a.
Tutorial 6 Working with Web Forms
Forms Review. 2 Using Forms tag  Contains the form elements on a web page  Container tag tag  Configures a variety of form elements including text.
Python and Web Programming
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Forms. Form An HTML form is a section of a document containing normal content, special elements called controls (checkboxes, radio buttons, buttons, etc.),
CST JavaScript Validating Form Data with JavaScript.
MS3304: Week 4 PHP & HTML Forms. Overview HTML Forms elements refresher Sending data to a script via an HTML form –The post vs. get methods –Name value.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
Forms and Form Controls Chapter What is a Form?
1 Forms A form is the usual way that information is gotten from a browser to a server –HTML has tags to create a collection of objects that implement this.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
INTRODUCTORY Tutorial 8 Creating Forms. XP New Perspectives on Blended HTML, XHTML, and CSS2 Objectives Create an HTML form Create fields for text Create.
Using Client-Side Scripts to Enhance Web Applications 1.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
1 HTML Forms
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
HTML FORMS GET/POST METHODS. HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes,
HTML Form and PHP IST Review of Previous Class HTML table and PHP array Winner is chosen randomly using rand() function.
XHTML & Forms. PHP and the WWW PHP and HTML forms – Forms are the main way users can interact with your PHP scrip Typical usage of the form tag in HTML.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Creating Web Page Forms. Introducing Web Forms Web forms collect information from users Web forms include different control elements including: –Input.
1 HTML Forms
1 Review of Form Elements. 2 The tag Used in between tags.  Form elements(text control, buttons, etc.. ) goes here. OR  Form elements(text control,
HTML Forms. Slide 2 Forms (Introduction) The purpose of input forms Organizing forms with a and Using different element types to get user input A brief.
HTML Forms a form is a container for input elements on a web page input elements contain data that is sent to the web server for processing.
Forms Collecting Data CSS Class 5. Forms Create a form Add text box Add labels Add check boxes and radio buttons Build a drop-down list Group drop-down.
HTLM Forms CS3505. Form Handling in Browser html User Files out form WEbBROWSErWEbBROWSEr User read response submit Get URL?input html Get file html script.
SYST Web Technologies SYST Web Technologies XHTML Forms.
+ FORMS HTML forms are used to pass data to a server. begins and ends a form Forms are made up of input elements Every input element has a name and value.
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Website Forms / Data Acquisition.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
HTML Forms.
Week 10: HTML Forms HNDIT11062 – Web Development.
Copyright (c) 2004 Prentice-Hall. All rights reserved. 1 Committed to Shaping the Next Generation of IT Experts. Project 6: Creating XHTML Forms Kelly.
1 HTML forms (cont.)
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Tutorial 6 Creating a Web Form
HTML III (Forms) Robin Burke ECT 270. Outline Where we are in this class Web applications HTML Forms Break Forms lab.
Lesson 5 Introduction to HTML Forms. Lesson 5 Forms A form is an area that can contain form elements. Form elements are elements that allow the user to.
HTML Structure II (Form) WEEK 2.2. Contents Table Form.
Unit 4 Working with data. Form Element HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons,
FORMS Explained By: Jasdeep Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
JavaScript, Sixth Edition
Chapter 5 Validating Form Data with JavaScript
How to Write Web Forms By Mimi Opkins.
Validation and Building Small Apps
Introducing Forms.
FORM OBJECT When creating an interactive web site for the Internet it is necessary to capture user input and process this input. Based on the result of.
Presentation transcript:

Forms, Validation Week 7 INFM 603

Announcements Try placing today’s example in htdocs (XAMPP). This will allow you to execute examples that rely on PHP Video  What most schools don't teach – Google Chrome App – validator/cgndfbhngibokieehnjhbjkkhbfmhojohttps://chrome.google.com/webstore/detail/html- validator/cgndfbhngibokieehnjhbjkkhbfmhojo

Agenda Forms JS/CSS/HTML Separation Form Validation DOM

Separating Content from Behavior Keep each of the following separate –Content (HTML) –Presentation (CSS) –Behavior (JavaScript) Separating HTML and JavaScript –Use src attribute of –Example: folder named Separation

Advantages of Separation Simplifies HTML files (removes large segments of JavaScript code) Functions can be cached by the browser for efficiency Code sharing/reuse  Function used by several pages can be kept in a single file

Use of JavaScript in Web Pages Unobtrusive JavaScript  programming paradigm specifying that JavaScript should not intrude on users accessing a web page, on HTML content, or CSS Stylesheets Goals –Keep JavaScript code separate from HTML –Scripts are enhancements to HTML content, but the content should be available without JavaScript You should design web pages so they operate even if JavaScript is disabled

Web Servers What is a Web Server? Installing XAMPP – Using XAMPP –Your documents live in htdocs folder –Creating a web repository for a user translates to creating a folder

CheckBoxes Allow us to make a selection Defined by using type=“checkbox” We can tell whether an entry is selected by using the “checked” property – true  entry has been selected Default selection by using checked=“checked” Example: Checkboxes.html –It is used when submitting data to a server

Radio Buttons Exist in groups and only one can be checked in a group Defined by using type=“radio” We defined the radio buttons to be in the same group by using the same name for all of them Note: Do not use the same value for name and id Default selection by using checked=“checked” We access the elements using arrays document.getElementsByName  returns array Example: RadioButtons.html 9

Drop-Down/Scrollable Lists Defined using the tag (not the tag) tag to specify possible options To define a default choice use: selected=“selected” The multiple attribute in allows for selection of multiple items (usually displayed as a multiple-selection list) Example: DropDownList.html Example: ScrollableList.html –Notice you can have multiple default selections

Textareas Allows user to input more than one line of information We use the tag rows and cols attributes define the text area Default text (if any) appears between the and tags Example: Textarea.html

HTML5 Form Controls HTML5 introduces new form controls and data verification Let’s take a look at one example –Notice that we are also using some CSS3 properties Example: FormElements.html, FormElements.css Let’s see the page using different browsers

HTML Forms Forms  Previous examples of forms just collected data for processing by a JavaScript program Forms  Means by which information passes from the user to a server name attribute –The name attribute is used by servers to retrieve data sent via form –Most of the time we will set the name and id attributes to the same value Submit button –Sends form data to a server application –It is this special functionality that other buttons do not have  Two important attributes: action  indicates where the form contents will be sent method  defines how the contents will be sent Example: searchBox.html –Look at the URL after submission

HTML Forms Method  Two alternatives –post - content is sent in the body of the message –get - contents included in the URL Example: formGet.html, getProcessing.php Example: formPost.html, postProcessing.php Important: You can only see the results if you have a web server running the.php files.

GET vs. POST Get –Information visible as it is displayed in the URL –Limited in the amount of information it can sent –URLs associated with get can be bookmarked –Intended for operations that will not change the server state Post –Information is not presented in the URL –No limits on amount of information it can send –Because variables are not displayed in the URL it is not possible to bookmark the page –Intended for operations that will change the server state Try reloading a form submitted using post. Why the warning? What google search uses? What yahoo search uses?

Form Validation Form data validation –We can validate the data associated with a form by recognizing the submit event –window.onsubmit = validateData; validateData is a function that will check for data validity It will return true or false Keep in mind that JavaScript can be disabled therefore the server application must also validate the data Example: formValidation example –Notice the organization code (HTML, CSS, JS separate) –This example is representative of what you need to do for the project

Getting String Characters The function charAt Allows us to retrieve the character associated with a particular index position in a string. Access is similar to array indexing (first character at 0) Example –var x = "Wednesday"; –var secondCharacter = x.charAt(1); // variable has "e"; –var lengthOfString = x.length; // variable has 9 This function is helpful when trying to validate data Example: charAt.html