BIT116: Scripting Radio Buttons.

Slides:



Advertisements
Similar presentations
CTER Orientation Tutorial The Use of the WebBoard.
Advertisements

Microsoft Expression Web-Illustrated Unit J: Creating Forms.
Hypertext markup language.  Client asks for an html file  Server returns the html file  Client parses and displays it  This display is what most people.
Modifying existing content Adding/Removing content on a page using jQuery.
The Web Warrior Guide to Web Design Technologies
CIS101 Introduction to Computing Week 08. Agenda Your questions JavaScript text Resume project HTML Project Six This week online Next class.
Capturing user input: Using HTML FORMs User input Up till now, our HTML documents have all been directed at outputting information to the user However,
Web Page Development Identify elements of a Web Page Start Notepad
CIS101 Introduction to Computing Week 11. Agenda Your questions Copy and Paste Assignment Practice Test JavaScript: Functions and Selection Lesson 06,
CIS101 Introduction to Computing Week 12 Spring 2004.
Inventory Throughout this slide show there will be hyperlinks (highlighted in blue) follow the hyperlinks to navigate to the specified Topic or Figure.
PHP and SQL Server: Queries IST2101. Project Report 4 SQL Queries Due Sunday, 4/5 at 11:59pm Instructions on how to access team webspace and SQL database.
More Event-Driven Programming Chapter Exercise Make a button whose label toggles between "on" and "off".
1 Events Lect 8. 2 Event-driven Pages one popular feature of the Web is its interactive nature e.g., you click on buttons to make windows appear e.g.,
Tutorial #9 – Creating Forms. Tutorial #8 Review – Tables Borders (table, gridlines), Border-collapse: collapse; empty-cells: show; and rowspan, colspan.
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.
BIT 115: Introduction To Programming1 Sit in front of a computer Log in –Username: 230class –password: –domain: student Bring up the course web.
Moodle (Course Management Systems). Assignments 1 Assignments are a refreshingly simple method for collecting student work. They are a simple and flexible.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
Client Side Programming with JavaScript Why use client side programming? Web sides built on CGI programs can rapidly become overly complicated to maintain,
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.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
HTML Concepts and Techniques Fifth Edition Chapter 6 Using Frames in a Web Site.
Creating Web Page Forms. Introducing Web Forms Web forms collect information from users Web forms include different control elements including: –Input.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
Application Day: Branching Adventure.  Quiz  Let's look at the schedule  Branching Adventure - explanation  Branching Adventure – work time 2.
HTML Hyper Text Markup Language 1BFCET BATHINDA. Definitions Web server: a system on the internet containing one or more web site Web site: a collection.
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.
Loops.  (No Quiz)  Hand in Assignment #1  Last chance for Q+A on the midterm  Loops 2.
Student Pages
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.
BIT116: Scripting Associative Arrays. Today AngularJS Q + A for the exam 2.
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.
Review of HTML and CSS A (very) brief review of some key fundamentals to be aware of in IT-238.
Logical Operators.  Quiz  Let's look at the schedule  Logical Operators 2.
Check Boxes. 2 Check boxes  Image from:  HTML:  Each box gets it's own.
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.
BIT 115: Introduction To Programming. 2 Today Midterm feedback Getting User Input.
Organic Chemistry Lab 315 Fall, DUE DATES Today –At beginning of lab – Organic Qualitative Analysis and ID of Unknown.
JavaScript Part 1 Introduction to scripting The ‘alert’ function.
BIT116: Scripting Lecture 05
Hidden Slide for Instructor
BIT116: Scripting Lecture 06
Checkboxes, Select boxes, Radio buttons,
BIT116: Scripting Loops.
Arrays: Checkboxes and Textareas
Cascading Style Sheets for layout
CS 0134 (term 2181) Jarrett Billingsley
Retrieving information from forms
Form Validation and AJAX
Log in to the computer in front of you
HTML Forms and User Input
Conditions and Ifs BIS1523 – Lecture 8.
Number and String Operations
UNITY TEAM PROJECT TOPICS: [1]. Unity Collaborate
In Class Program: Today in History
We are starting to program with JavaScript
Due Next Monday Assignment 1 Start early
Log in to the computer in front of you
Log in to the computer in front of you
BIT 115: Introduction To Programming
BIT116: Scripting Lecture 6 Part 1
Introduction to Programming and JavaScript
Unit 1 Sections 1-4 Sentence Frames
Working with ‘checked’ items Checkboxes and Radio buttons
Organic Chemistry Lab 315 Fall, 2016
Retrieving information from forms
Checkboxes, Select boxes, Radio buttons
Presentation transcript:

BIT116: Scripting Radio Buttons

Let’s first review due dates A2 first revision is due today A1 revision is (technically) due at the start of next class I promise that I’ll grade the midterm exam before A1 revision So you’ll (technically) have an extra day or two to finish A1 Remember that you can upload your work as many times as you’d like…. … just make sure to include a complete copy (ALL FILES) even if you haven’t changed some A3 is due in 1 week

Today Quiz Go over the Midterm Topic List Radio Buttons Check boxes

Radio buttons

Radio buttons Image from: https://en.wikipedia.org/wiki/Radio_button HTML: We're NOT going to use id here (we can't have duplicates id's) Instead, we're going to give all the individual HTML elements the same name (name attribute allows for duplicates) We need to define the text separately "Cat", "Dog", and "Turtle" in the above image FILE: radio_buttons_demo.html

What the demo page looks like:

<h2>Radio Buttons</h2> <form> <h3>How much does BIT 116 rock?</h3> <p> <input type="radio" name="enthusiasm" value="High">Totally A Ton!!!!<br/> Text before button <input type="radio" name="enthusiasm" value="SoSo"> It's Ok <!-- since there's no br, there's no line break --> <input type="radio" name="enthusiasm" value="Low">Why, God, why did I sign up for this class?<br/> <input type="button" id="getFeedback" value="Click here for feedback!"> </p> </form> <p id="msgHere">Some Fascinating Text! That I will change! With jQuery!</p> <input = Start of the button itself. Note that there's no closing tag. This element puts ONLY the button on the page type="radio" = Tells the browser to put a radio button on the page name="enthusiasm" = We picked enthusiasm. Pick any valid name you want, but be consistent value="High"> = Again, pick anything you want (we picked High). Each button needs to have a unique value. For the others we picked SoSo and Low. Totally A Ton!!!!<br/> = Notice that the text is outside the button and unconnected to it

$("#getFeedback").click( function() { var whichOne = $('input:radio[name=enthusiasm]:checked').val(); // First, what do we get: // >>> is added so it's clear what the var is, even if it's empty/blank alert(">>>" + whichOne + "<<<"); $('input = We're going to start by asking for all the 'input elements, and then filtering out the ones we're not interested in :radio = Ignore (filter out) anything who's type is not radio (as specified using the type="radio" attribute in the HTML – see previous slide) [name=enthusiasm] = Amongst the radio buttons, only look at those elements who have a name attribute and that name attribute is 'enthusiasm' :checked') = Amongst the radio inputs named 'enthusiasm', select the one that is checked (if any) .val(); = Finally, get the value from that button. The value will be either High, SoSo, or Low (as specified using the value="…"> attribute in the HTML – see previous slide)

$("#getFeedback").click( function() { var whichOne = $('input:radio[name=enthusiasm]:checked').val(); // First, what do we get: // >>> is added so it's clear what the var is, even if it's empty/blank alert(">>>" + whichOne + "<<<"); We're going to start off by simply showing the value of the radio button

// <snip> - to fit everything on one slide  $("#getFeedback").click( function() { var whichOne = $('input:radio[name=enthusiasm]:checked').val(); // <snip> - to fit everything on one slide  if( whichOne === undefined ) $("#msgHere").html( "You need to make a choice!"); else if( whichOne === "High" ) $("#msgHere").html( "Great! I'm glad that you're enjoying the course"); else if( whichOne === "SoSo" ) $("#msgHere").html( "That's too bad. What can I do to help?"); else if( whichOne === "Low" ) $("#msgHere").html( "That's definitely too bad! Please talk to the prof to get some help ASAP!! :( :( :("); else $("#msgHere").html( "INTERNAL ERROR: We should never execute this line of code!!"); }); if( whichOne === undefined ) = check if the user didn't select anything NOTE: there's no quotes around the undefined !!! if( whichOne === "High" ) = Otherwise look for the text that we specified in the HTML else = We shouldn't need this, but it's better to be safe than sorry

Do Exercises Work on Exercise #1 for the 'radio buttons' section of this lecture