Check Boxes. 2 Check boxes  Image from: https://en.wikipedia.org/wiki/Checkboxhttps://en.wikipedia.org/wiki/Checkbox  HTML:  Each box gets it's own.

Slides:



Advertisements
Similar presentations
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?
Advertisements

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.
The Web Warrior Guide to Web Design Technologies
FORMs Lesson TBE 540. Prerequisites Before beginning this lesson, the learner must be able to… –Create basic web pages using a text editor and/or a web.
Web Page Development Identify elements of a Web Page Start Notepad
Computer Science 103 Chapter 4 Advanced JavaScript.
Python and Web Programming
JavaScript Lesson 1 TBE 540. Prerequisites  Before beginning this lesson, the learner must be able to… Create a basic web page using a text editor and/or.
Session 2 Tables and forms in HTML Adapted by Sophie Peter from original document by Charlie Foulkes.
  Just another way to collect pieces together (like div, section)  Anything can be in there  Formatting just like all other elements.
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.
Lesson 8 Creating Forms with JavaScript
1 ADVANCED MICROSOFT WORD Lesson 15 – Creating Forms and Working with Web Documents Microsoft Office 2003: Advanced.
JavaScript Form Validation
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.
4-Sep-15 HTML Forms Mrs. Goins Web Design Class. Parts of a Web Form A Form is an area that can contain Form Control/Elements. Each piece of information.
JS: DOM Form Form Object Form Object –The Form object represents an HTML form. –For each instance of a tag in an HTML document, a Form object is created.
Jquery IS JQuery Jquery Example of mouseover event that shows a submenu when menu selected: $(‘#menu’).mouseover(function() { $(‘#submenu’).show();
JavaScript Lecture 6 Rachel A Ober
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
What is Museum Box? A Museum box is a way of presenting information that allows you to create a cube project that can be shared with others. You can use.
Lesson13. JavaScript JavaScript is an interpreted language, designed to function within a web browser. It can also be used on the server.
Client Side Programming with JavaScript Why use client side programming? Web sides built on CGI programs can rapidly become overly complicated to maintain,
CO1552 Web Application Development HTML Forms, Events and an introduction to JavaScript.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
  Just another way to collect pieces together (like div, section)  Anything can be in there  Formatting just like all other elements  Always name.
HTML and FORMS.  A form is an area that can contain form elements.  Form elements are elements that allow the user to enter information (like text fields,
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.
HTML Form Widgets. Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back.
ITM © Port, Kazman1 ITM 352 More on Forms Processing.
JavaScript, Fourth Edition
SYST Web Technologies SYST Web Technologies XHTML Forms.
Conditional Statements.  Quiz  Hand in your jQuery exercises from last lecture  They don't have to be 100% perfect to get full credit  They do have.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
Unit 10 – JavaScript Validation Instructor: Brent Presley.
JavaScript Challenges Answers for challenges
Event Handling. Objectives Using event handlers Simulating events Using event-related methods.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Variables, Functions and Events (NON-Audio version) © Dr. David C. Gibbs WDMD.
Radio Buttons.  Quiz  Radio Buttons  Check boxes 2.
Lesson 16. Practical Application 1 We can take advantage of JavaScript and the DOM, to set up a form so that the first text box of a form automatically.
Functions.  Assignment #2 is now due on Wednesday, Nov 25 th  (No Quiz)  Go over the midterm  Backtrack and re-cover the question about tracing the.
FORMS How to collect information f XX rom visitors Different kinds of form controls New HTML5 form controls.
QUESTIONNAIRE AND SPREAD SHEET PRINT SCREENS By Olivia Acus.
LESSON : EVENTS AND FORM VALIDATION -JAVASCRIPT. EVENTS CLICK.
Logical Operators.  Quiz  Let's look at the schedule  Logical Operators 2.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
HTML. Hyper Text Markup Language Markup your text document The markup is the tag Hyper text means you can jump from place to place Programming language.
Web Forms. Web Forms: A form allows our web visitors to submit information to us. Some examples uses for forms are to let the web user contact us, fill.
Basic HTML Page 1. First Open Windows Notepad to type your HTML code 2.
HTML FORM. Form HTML Forms are used to select different kinds of user input. HTML forms are used to pass data to a server. A form can contain input elements.
Day 22, Slide 1 CSE 103 Day 22 Non-students: Please logout by 10:12. Students:
JavaScript, Third Edition 1 SELECTION LIST Demo. JavaScript, Third Edition 2 Description This web page will edit the slection to ensure an option was.
Logical Operators.  Quizzes!  Let's look at the schedule  Logical Operators 2.
BIT116: Scripting Lecture 05
Advanced HTML Tags:.
BIT116: Scripting Lecture 06
Checkboxes, Select boxes, Radio buttons,
Using the HTML and CSS Validation Services
HTML Forms CSC 102 Lecture.
Retrieving information from forms
Web Programming– UFCFB Lecture 17
HTML/XHTML Forms 18-Sep-18.
More Selections BIS1523 – Lecture 9.
Javascript Game Assessment
BIT116: Scripting Radio Buttons.
Working with ‘checked’ items Checkboxes and Radio buttons
Web Programming and Design
Murach's JavaScript and jQuery (3rd Ed.)
Retrieving information from forms
Presentation transcript:

Check Boxes

2 Check boxes

 Image from:  HTML:  Each box gets it's own id  Note that the text is defined separately  "Checked", "Tristate / Indeterminate", and "Unchecked" in the above image  FILE: checkboxes_simple_demo.html 3

4

Check boxes What did you do this past weekend? Slept Some Worked on my homework Ate Some Food Experienced a Deep, Existential Dread At The Approaching Week Some Fascinating Text! That I will change! With jQuery!  <input = Start of the checkbox itself. Note that there's no closing tag. This element puts ONLY the check box on the page, not the text that goes next to it.  id="checkboxSlept" = We picked checkboxSlept. Pick any valid name you want, but be consistent  type="checkbox" = Tells the browser to put a check box (but NOT text) on the page  value="Slept" = Again, pick anything you want (we picked Slept). We'll check for this value in the JavaScript once the button is clicked  checked="checked"> = Tell the browser that this box should start off checked. We can just write checked if we'd prefer  Slept Some = Notice that the text is outside the button and unconnected to it 5

if( $('#checkboxSlept').is( ':checked' ) ) feedback = feedback + " slept";  $('#checkboxSlept = What's nice is that we can go back to asking for a particular checkbox by ID .is() = Ask if the selected element(s) have a particular attribute, etc  ':checked' = Specifically, is the checkbox checked?  This will return true if the box is checked off, and will return false otherwise 6

 Start with the text at the beginning of the sentence  For each checkbox:  If it's checked then add that box's text to the existing text  If we didn't check off anything then replace all the text with a different message  Otherwise we'd get the beginning and the end glued together: "I'm glad that you this weekend"  Then, of course, place that text on the page 7

$("#getFeedback").click( function() { var startingText = "I'm glad that you "; var feedback = startingText; if( $('#checkboxSlept').is(':checked') ) feedback = feedback + " slept"; if( $('#checkboxHW').is(':checked') ) feedback = feedback + ", studied"; if( $('#cbAte').is(':checked') ) feedback = feedback + ", ate"; if( $('#cbDread').is(':checked') ) feedback = feedback + ", and dreaded"; if( feedback == startingText) // if no options were chosen feedback = "Wait - you didn't eat or sleep this weekend? Or study? Or dread?"; else feedback = feedback + " this weekend."; $("#msgHere").html( feedback ); }); var startingText = "I'm glad that you "; = This is the beginning of the sentence. We'll want to use it again later… var feedback = startingText; = so we're making a copy of it in feedback. We'll add things onto feedback 8

$("#getFeedback").click( function() { var startingText = "I'm glad that you "; var feedback = startingText; if( $('#checkboxSlept').is(':checked') ) feedback = feedback + " slept"; if( $('#checkboxHW').is(':checked') ) feedback = feedback + ", studied"; if( $('#cbAte').is(':checked') ) feedback = feedback + ", ate"; if( $('#cbDread').is(':checked') ) feedback = feedback + ", and dreaded"; if( feedback == startingText) // if no options were chosen feedback = "Wait - you didn't eat or sleep this weekend? Or study? Or dread?"; else feedback = feedback + " this weekend."; $("#msgHere").html( feedback ); }); if( $('#checkboxSlept').is(':checked') ) = if the 'checkboxSlept' check box is checked…. feedback = feedback + " slept"; = then glue (concatenate) the text " slept" onto our feedback 9

$("#getFeedback").click( function() { var startingText = "I'm glad that you "; var feedback = startingText; if( $('#checkboxSlept').is(':checked') ) feedback = feedback + " slept"; if( $('#checkboxHW').is(':checked') ) feedback = feedback + ", studied"; if( $('#cbAte').is(':checked') ) feedback = feedback + ", ate"; if( $('#cbDread').is(':checked') ) feedback = feedback + ", and dreaded"; if( feedback == startingText) // if no options were chosen feedback = "Wait - you didn't eat or sleep this weekend? Or study? Or dread?"; else feedback = feedback + " this weekend."; $("#msgHere").html( feedback ); }); if( $('#checkboxHW').is(':checked') ) = Similarly (and independently) add ", studied" if the user studied feedback = feedback + ", studied"; 10

$("#getFeedback").click( function() { var startingText = "I'm glad that you "; var feedback = startingText; if( $('#checkboxSlept').is(':checked') ) feedback = feedback + " slept"; // - to fit everything on one slide if( feedback == startingText) // if no options were chosen feedback = "Wait - you didn't eat or sleep this weekend? Or study? Or dread?"; else feedback = feedback + " this weekend."; $("#msgHere").html( feedback ); }); if( feedback == startingText) = if the user didn't check anything, then feedback will be the same as the original, starting text. In other words – this will check if the user didn't check off anything 11

$("#getFeedback").click( function() { var startingText = "I'm glad that you "; var feedback = startingText; if( $('#checkboxSlept').is(':checked') ) feedback = feedback + " slept"; // - to fit everything on one slide if( feedback == startingText) // if no options were chosen feedback = "Wait - you didn't eat or sleep this weekend? Or study? Or dread?"; else feedback = feedback + " this weekend."; $("#msgHere").html( feedback ); }); feedback = "Wait - you didn't eat …"; = if the user didn't pick anything then use this message instead else = otherwise… feedback = feedback + " this weekend."; = add 'this weekend." to the end of our feedback 12

 Work on exercise #1 in the ICEs for 'checkboxes'  Note that this may be on a separate page than the 'radio buttons' exercise.  Go back to the main page for the course and find the ICEs there 13