UMass Lowell Dept. of Computer Science

91.461 GUI Programming I

Fall 2015 Semester, Section 201

Prof. Jesse M. Heines

Notes for Class No. 16

Introduction to jQuery (continued)

Tuesday, October 27, 2015

A video of this class is (or will be) posted at:   http://echo360.uml.edu/heines201516/guiprogramming1.html


Handouts and Materials

Assignment No. 7 is now posted


Openings / Announcements / Reminders

Faculty Advising Period began yesterday


Class Notes

Related reading for this class:  JS&jQ:TMM Ch. 5


Basic Validation using JavaScript and jQuery  (continued)

Review from last class ...

Remember that if you want to write to document objects, they must first exist

1  $(document).ready( function() {
2    tblInitializer.initialize() ;
3    tblGenerator.populateMultiplicationTable_jQuery( "#placeholder", true ) ;
4    $('#frm').submit( function() {  // trap the submit event *before* the action is executed
5      return validateForm() ;       // true = allow action to proceed, false = inhibit action
6    } ) ;
7  } ) ;  // end ready

In the above code,

Writing validation tests

New material begins here ...

Three pillars of good error messages:

Initializing form fields


Difference between JavaScript object literal notation and JSON

In JSON,

From en.wikipedia.org/wiki/JSON

JSON’s basic types are:

Thus, JSON has a much more limited syntax than JavaScript object literals, including:

The definitive specification of JSON syntax was written by Douglas Crockford in July 2006

http://tools.ietf.org/html/rfc4627

Addendum at the same StackOverflow URL:  Note that many people believe that JSON must be enclosed in curly brackets {}, but this is not true

Unfortunately, the code in the book (starting on p. 371) confuses all of these issues



This is document http://jesseheines.com:8080/~heines/91.461/91.461-2015-16f/461-lecs/lecture16.jsp.  It was last modified on Friday, August 26, 2022 at 4:09 PM.
Copyright © 2022 by Jesse M. Heines.  All rights reserved.  May be freely copied or excerpted for educational purposes with credit to the author.