<HTML>
<HEAD>
<TITLE>Software Development - U.S. Census Name Data Demo Program</TITLE>
<META AUTHOR="Jim Skon">
</HEAD>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
  <!-- $Id: bibleajax.html,v 1.6 jskon Exp $ -->
  <title>GNU cgicc Name Data Form</title>
</head>

<script type = "text/javascript">
var XMLHttp;
if(navigator.appName == "Microsoft Internet Explorer") {
    XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
} else {
    XMLHttp = new XMLHttpRequest();
}

// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
  if(!radioObj)
     return "";
  var radioLength = radioObj.length;
  if(radioLength == undefined)
     if(radioObj.checked)
        return radioObj.value;
     else
        return "";
  for(var i = 0; i < radioLength; i++) {
     if(radioObj[i].checked) {
        return radioObj[i].value;
    }
  }
  return "";
}

function getresponse () {
    var rs = getCheckedValue(document.radioResultsSelect.results_select);
    var ts = getCheckedValue(document.radioResultsSelect.type_select);

    XMLHttp.open("GET", "/csc3004/skon/cgi-bin/namefetchajax?"
                      + "results_select=" + rs
  + "&type_select=" + ts
  + "&name=" + document.getElementById('name').value
  ,true);
    XMLHttp.onreadystatechange=function() {
 document.getElementById('response_area').innerHTML = XMLHttp.responseText;
 }
 XMLHttp.send(null);
}


</script>

<BODY bgcolor="Aquamarine">
<H1>Software Development - U.S. Census Name Data Demo Program</H1>
<P>This program is designed to demonstrate a simple client/server program. 
A server program runs in the background, waiting for Name/Data requests.  When it receives a name request
it returns the matching data.
<P>  The reason for such a architecture is to allow a simple program, with a MAP preloaded with data,
to quickly provide results without incurring the overhead of a reloading the census data for each request. 
<br> (Written by Dr. Jim Skon)



<P>
Select which type of search you would like to perform:
<form name="radioResultsSelect">
<TABLE>
<TR>
<TD ALIGN=RIGHT VALIGN=TOP><INPUT NAME="type_select" TYPE="radio" VALUE="Last" checked id=last></TD>
<TD ALIGN=LEFT VALIGN=TOP>Last Names</TD></input>

<TD ALIGN=RIGHT VALIGN=TOP><INPUT NAME="type_select" TYPE="radio" VALUE="Male"  id=male></TD>
<TD ALIGN=LEFT VALIGN=TOP>Male First Names</TD></input>

<TD ALIGN=RIGHT VALIGN=TOP><INPUT NAME="type_select" TYPE="radio" VALUE="Female"  id=female></TD>
<TD ALIGN=LEFT VALIGN=TOP>Female First Names</TD></input>

</TR>
</TABLE>

<P>
<form name="radioResultsSelect">
<TABLE>
<TR>
<TD ALIGN=RIGHT VALIGN=TOP><INPUT NAME="results_select" TYPE="radio" VALUE="List" checked id=results_select_many></TD>

<TD ALIGN=LEFT VALIGN=TOP>Return a list of close matches</TD></input>

<TD ALIGN=RIGHT VALIGN=TOP><INPUT NAME="results_select" TYPE="radio" VALUE="One"  id=results_select_1></TD>
<TD ALIGN=LEFT VALIGN=TOP>Return only the best match</TD></input>

</TR>
</TABLE>
</form>
<HR>
Last name to look up data for: 
<INPUT NAME="name" TYPE="text" id=name MAXLENGTH=30></TD>

<p>
<input type="submit" onclick="javascript: getresponse ()" name="submit" value="Submit" />
</p>


<div id = "response_area">
</div>


</BODY>
</HTML>

-- JimSkon - 2011-03-02

Topic revision: r2 - 2011-03-08 - JimSkon
 
This site is powered by the TWiki collaboration platformCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback