Dynamic Web-Enabled Data Collection



Similar documents
Internet Technologies

HTML Form Widgets. Review: HTML Forms. Review: CGI Programs

c. Write a JavaScript statement to print out as an alert box the value of the third Radio button (whether or not selected) in the second form.

Building a Customized Data Entry System with SAS/IntrNet

JavaScript Basics & HTML DOM. Sang Shin Java Technology Architect Sun Microsystems, Inc. sang.shin@sun.com

JavaScript and Dreamweaver Examples

Client-side Web Engineering From HTML to AJAX

ABSTRACT INTRODUCTION %CODE MACRO DEFINITION

How to Create Dynamic HTML and Javascript using your Data Jennifer Sinodis, Bank One, Phoenix, AZ

InPost UK Limited GeoWidget Integration Guide Version 1.1

HTML Forms and CONTROLS

2- Forms and JavaScript Course: Developing web- based applica<ons

Creating a Html Form in the CMA

In order for the form to process and send correctly the follow objects must be in the form tag.

JavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK

Using SAS/IntrNet as a Web-Enabled Platform for Clinical Reporting

The Basics of Dynamic SAS/IntrNet Applications Roderick A. Rose, Jordan Institute for Families, School of Social Work, UNC-Chapel Hill

Configuring iplanet 6.0 Web Server For SSL and non-ssl Redirect

A Tale of the Weaknesses of Current Client-side XSS Filtering

TCP/IP Networking, Part 2: Web-Based Control

Yandex.Widgets Quick start

The Elements of a Good HTML Application

Web Development 1 A4 Project Description Web Architecture

Working with forms in PHP

Chapter 2: Interactive Web Applications

«W3Schools Home Next Chapter» JavaScript is THE scripting language of the Web.

FORM-ORIENTED DATA ENTRY

JavaScript: Arrays Pearson Education, Inc. All rights reserved.

NMDS-V APPLICATION GOALS

INTRODUCTION WHY WEB APPLICATIONS?

Mul$media im Netz (Online Mul$media) Wintersemester 2014/15. Übung 06 (Nebenfach)

CS412 Interactive Lab Creating a Simple Web Form

<option> eggs </option> <option> cheese </option> </select> </p> </form>

Intell-a-Keeper Reporting System Technical Programming Guide. Tracking your Bookings without going Nuts!

Website Login Integration

Further web design: HTML forms

The Web, SAS, and Security Daryl B. Baird, Trilogy Consulting, Denver, CO

Viewing Form Results

Implementing Specialized Data Capture Applications with InVision Development Tools (Part 2)

PHP Form Handling. Prof. Jim Whitehead CMPS 183 Spring 2006 May 3, 2006

ACCESSING THE PROGRESS OPENEDGE APPSERVER FROM PROGRESS ROLLBASE USING JSDO CODE

Programming the Web 06CS73 SAMPLE QUESTIONS

3M Information Technology

FORMS. Introduction. Form Basics

Web application development (part 2) Netzprogrammierung (Algorithmen und Programmierung V)

Inserting the Form Field In Dreamweaver 4, open a new or existing page. From the Insert menu choose Form.

InternetVista Web scenario documentation

Lab 5 Introduction to Java Scripts

07 Forms. 1 About Forms. 2 The FORM Tag. 1.1 Form Handlers

Developing an On-Demand Web Report Platform Using Stored Processes and SAS Web Application Server

IMRG Peermap API Documentation V 5.0

HTML Tables. IT 3203 Introduction to Web Development

It is highly recommended that you are familiar with HTML and JavaScript before attempting this tutorial.

CGI Programming. What is CGI?

Upload Center Forms. Contents. Defining Forms 2. Form Options 5. Applying Forms 6. Processing The Data 6. Maxum Development Corp.

jquery Tutorial for Beginners: Nothing But the Goods

People Data and the Web Forms and CGI. HTML forms. A user interface to CGI applications

TECHNIQUES FOR BUILDING A SUCCESSFUL WEB ENABLED APPLICATION USING SAS/INTRNET SOFTWARE

Dynamic Content. Dynamic Web Content: HTML Forms CGI Web Servers and HTTP

XHTML Forms. Form syntax. Selection widgets. Submission method. Submission action. Radio buttons

AJAX The Future of Web Development?

ANGULAR JS SOFTWARE ENGINEERING FOR WEB SERVICES HASAN FAIZAL K APRIL,2014

Multimedia im Netz Online Multimedia Winter semester 2015/16. Tutorial 03 Major Subject

Finding XSS in Real World

IBM Tivoli Access Manager for e-business 6.1: Writing External Authentication Interface Servers

When you have selected where you would like the form on your web page, insert these lines of code to start:

Forms, CGI Objectives. HTML forms. Form example. Form example...

Tutorial 6 Creating a Web Form. HTML and CSS 6 TH EDITION

Hands-On Workshops HW003

Script Handbook for Interactive Scientific Website Building

Adventures in Building Web Applications: A Tutorial on Techniques for Real-World Applications

ASP (Active Server Pages)

HTML Forms. Pat Morin COMP 2405

CREATING WEB FORMS WEB and FORMS FRAMES AND

SAS/IntrNet 9.4: Application Dispatcher

4 Understanding. Web Applications IN THIS CHAPTER. 4.1 Understand Web page development. 4.2 Understand Microsoft ASP.NET Web application development

Direct Post Method (DPM) Developer Guide

Web Programming with PHP 5. The right tool for the right job.

A Generic Solution to Running the SAS System on the Web Without SAS/Intrnet David L. Ward, InterNext, Inc., Somerset, NJ

payment solutions The DirectOne E-Commerce System Technical Manual

AJAX and JSON Lessons Learned. Jim Riecken, Senior Software Engineer, Blackboard Inc.

Web Development CSE2WD Final Examination June (a) Which organisation is primarily responsible for HTML, CSS and DOM standards?

A Complete Guide to HTML Form Output for SAS/IntrNet Developers Don Boudreaux, SAS Institute Inc., Austin, TX

JAVASCRIPT AND COOKIES

Chapter 5 Configuring the Remote Access Web Portal

Spectrum Technology Platform

MASTERTAG DEVELOPER GUIDE

JavaScript: Introduction to Scripting Pearson Education, Inc. All rights reserved.

Javascript for beginners

PHP Tutorial From beginner to master

Fax via HTTP (POST) Traitel Telecommunications Pty Ltd 2012 Telephone: (61) (2) Page 1

Understanding Cross Site Scripting

Dynamic Web Pages With The Embedded Web Server. The Digi-Geek s AJAX Workbook

Reproductions supplied by EDRS are the best that can be made from the original document.

WIRIS quizzes web services Getting started with PHP and Java

Client-side programming with JavaScript. Laura Farinetti Dipartimento di Automatica e Informatica Politecnico di Torino laura.farinetti@polito.

By Glenn Fleishman. WebSpy. Form and function

Building Checkout Pages

Uploaded images filter evasion for carrying out XSS attacks

Tutorial: Building a Dojo Application using IBM Rational Application Developer Loan Payment Calculator

Transcription:

Dynamic Web-Enabled Data Collection S. David Riba, Introduction Web-based Data Collection Forms Error Trapping Server Side Validation Client Side Validation Dynamic generation of web pages with Scripting Using SAS to write HTML and JavaScript "on-the-fly" FILESRV Utility This course is 2002 All rights reserved. Unauthorized Duplication of any part of this course is strictly Prohibited Overview Thin client (browser-based) collection of information Traditionally, SAS has relied on server-side processing More efficient to pre-process on the client-side and post-process on the server-side Technologies reviewed: SAS/IntrNet, HTML, JavaScript 1-3

Typical Browser Form Header <FORM name="theform" method="post" action="http://some-server/cgi-bin/broker.exe" > <INPUT type=hidden name="_service" value="default"> <INPUT type=hidden name="_program" value="saspgm"> <INPUT type=hidden name="_debug" value="0"> Form Fields Go Here <INPUT type=submit value="submit Data"> </FORM> Common Field Types Text Entry Field <INPUT type=text name=company size=30 maxlength=60> SAS sees: %global company ; company = symget('company') ; Radio Button Common Field Types <INPUT name=q01 type=radio value=1 checked> Text A <INPUT name=q01 type=radio value=2> Text B <INPUT name=q01 type=radio value=3> Text C Returns a single name-value pair One variable - Q01 Possible values 1, 2, or 3 checked is optional - defines a default button 4-6

Check Boxes Common Field Types <INPUT name=q03a type=checkbox value=1> Text A <INPUT name=q03b type=checkbox value=1> Text B <INPUT name=q03c type=checkbox value=1> Text C Returns multiple name-value pairs Multiple variables Only those variables checked are returned Use %global to include all variables Use CHECKED to pre-select check boxes Dynamic SAS HTML Template FILE _webout ; IF (_n_ eq 1) then do ; PUT 'content-type: text/html' ; PUT ; PUT '<HEAD><TITLE>some title goes here</title>' / '<some more html goes here>' / '</HEAD>' / '<FORM action = " ' "%superq(_url)" ' ">' / '<INPUT type=hidden name="_service" value = " ' "%superq(_service)" ' ">' END ; Typical SAS Program Flow validate inputs generate error page if appropriate DATA steps & PROC steps - process inputs - run reports - generate feedback to user 7-9

Macro Program Control %local errorflag ; validate inputs generate error page if appropriate %let errorflag = Y ; %IF &errorflag ne Y %THEN %DO ; DATA steps & PROC steps - process inputs - run reports - generate feedback to user %END RUN Cancel ; %let cancel = ; validate inputs generate error page if appropriate call symput('cancel','cancel') ; DATA steps & PROC steps - process inputs - run reports - generate feedback to user RUN &cancel ; Client Side Validation Scripting Languages JavaScript VBScript Language implementation is different across different browsers Browsers may turn scripting off 10-12

External JavaScript The SCRIPT Tag <HTML><HEAD> <SCRIPT language = "JavaScript" src = "http://url/myscriptfile.js"> </SCRIPT> </HEAD> <BODY> </BODY></HTML> The SCRIPT Tag InStream JavaScript <HTML><HEAD> <SCRIPT language = "JavaScript"> <!-- hide this from non-javascript browsers function init() { } // --> </SCRIPT> </HEAD> <BODY> </BODY></HTML> JavaScript Event Handlers onchange when a field is changed onclick when a CheckBox or Radio Button is clicked onsubmit invoked when Form is submitted onfocus when user enters a field onload when web page is loaded or refreshed 13-15

Text Entry Using Event Handlers < INPUT type=text name=phone onchange="verifyme(phone.value)" > Radio Button or CheckBox < INPUT type=radio name=price value=100 onclick="this.form.total.value=calcamt( )" > Form < FORM name="theform" method="post" onload = "init( )" onsubmit="return validate( )" Text onchange Event < INPUT type=text name=q02 onchange="document.theform.q02g.value=calctot( )" > function CalcTot( ) { subtot = 0 if (document.theform.q02a.value > 0) subtot = subtot + parseint(document.theform.q02a.value) if (document.theform.q02b.value > 0) subtot = subtot + parseint(document.theform.q02b.value) --- document.theform.q02.value = subtot total = subtot if (document.theform.q02f.value > 0) total = total + parseint(document.theform.q02f.value) if (total > 100) alert("you can not have more than 100%") else return total } CheckBox onclick Event < INPUT type=checkbox name=q03a onclick="checkmax(this.form )" > function checkmax(form) { var count = 0 if(form.q03a.status == true) count += 1 if(form.q03b.status == true) count += 1 --- if(form.q03k.status == true) count += 1 if (count > 3) alert ("Too many selected - max 3 items") } 16-18

Form onsubmit Event < FORM name="theform" method="post" onload = "init( )" onsubmit="return validate( )" function validate() { var msg = "",msgtext; if (document.theform.company.length == 0) msg+="* Name \n"; if (document.theform.email.length == 0) msg+="* Email Address \n"; if (msg.length<=2) return true; else { msgtext = "- The following required field(s) are empty:\n"; msgtext+=msg; alert(msgtext); return false; } } Form onsubmit Event Problem: With SUBMIT button, some browsers automatically submit when the ENTER key is pressed One Solution: <INPUT type= button value = "Submit Survey" onclick="validate( this.form )"> function validate( form ) { if (msg.length<=2) form.submit( ) ; Server-Side Processing Remember to re-validate on the Server Side Javascript may not have worked User might have by-passed edits with GET method instead of POST Additional power of SAS for more sophisticated edits and error-checking 19-21

Server-Side Form Loading < FORM name="theform" method="post" onload = "init( )" > SET yourdataset end=eof ; FILE _webout ; IF ( _n_ eq 1 ) THEN PUT ' <HTML><HEAD><SCRIPT language="javascript"> ' / ' <BR> function init() { ' ; PUT 'document.theform.a01.value = " ' a01 ' " ; ' / 'document.theform.a02.value = " ' a02 ' " ; ' /* continue loading form values as appropriate */ IF (eof) THEN PUT ' } </SCRIPT></HEAD><BODY> ' / * put the rest of your html page here */ Check Boxes & Radio Buttons Attribute CHECKED is true or false document.theform.a06.checked = true Radio buttons are arrays always start with element zero if (trim(a10) eq "Increase") then put 'document.theform.a10[0].checked = true ' ; else if (trim(a10) eq "No Change") then put 'document.theform.a10[1].checked = true ' ; else if (trim(a10) eq "Decrease") then put 'document.theform.a10[2].checked = true ' ; FILESRV Utility Used to "serve up" external files Version 8 SAS/IntrNet and Application Dispatcher Files may be external or SAS catalog entries Documentation with SAS V8 IntrNet online at http://www.sas.com/rnd/web/intrnet/filesrv/filesrv.html Requires an authorization dataset (provided by SAS) an HTTP Headers dataset (provided by SAS) 22-24

FILESRV Syntax Invoking FILESRV from a Web Browser _PROGRAM=SASHELP.WEBPROG.FILESRV.SCL _FILE=name-of-file-being-served _FILETYP=C E Invoking FILESRV from a SAS Program %filesrv(file=name-of-file-being-served, filetyp=c E) Putting It All Together SET yourdataset end=eof ; FILE _webout ; IF ( _n_ eq 1 ) THEN PUT ' <HTML><HEAD><SCRIPT language="javascript"> ' / ' <BR> function init() { ' ; PUT 'document.theform.a01.value = " ' a01 ' " ; ' / 'document.theform.a02.value = " ' a02 ' " ; ' /* continue loading form values as appropriate */ IF (eof) THEN PUT ' } </SCRIPT></HEAD> ' ; %FILESRV ( file = 'your-body-file.htm', filetype = E ) ; Resources Internet based HTML and JavaScript scripts and tutorials http://www.javascript.com http://www.webreference.com/js http://www.scriptsearch.com http://developer.netscape.com/tech/javascript/ http://www.wdvl.com 25-27

Questions?? S. David Riba P. O. Box 4517 Clearwater, FL 33758 (727) 726-6099 E-Mail: dave@jadetek.com INTERNET: http://www.jadetek.com 28-30