Java Reference
In-Depth Information
Also, set the values of all the fields to an empty string. For example, the journal
field value is set as follows:
var journalElement = document.getElementById(“journal”);
journalElement.value = «»;
If the <valid/> element value is set to false , set the HTML of the
validationMessage div in the CatalogID field row to " Catalog Id is not
Valid ", and disable the Submit button. Set the values of the other input fields
as shown for the journal field below. Setting the values of the other fields
corresponding to a CatalogId is an example of auto-completion with AJAX.
var validationMessage=document.getElementById("validationMessage");
validationMessage.innerHTML = "Catalog Id is not Valid";
document.getElementById("submitForm").disabled = true;
var journal=xmlMessage.getElementsByTagName(“journal”)[0].firstChild.
var journalElement=document.getElementById(“journal”);
journalElement.value = journal;
The Ajax user interface JSP
The Ajax user interface input.jsp is listed next:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<script type="text/javascript">
function validateCatalogId() {
var xmlHttpRequest = init();
function init() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
} else if (window.ActiveXObject) {
return new ActiveXObject("Microsoft.XMLHTTP");
var catalogId = document.getElementById("catalogId");"GET", "ejb3clientservlet?catalogId="
+ encodeURIComponent(catalogId.value), true);
Search WWH ::

Custom Search