Java Reference
In-Depth Information
The following code is an example of the response HTML page:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN”
“http://www.w3.org/TR/html4/strict.dtd”>
<html>
<head>
<title>Returned Data</title>
</head>
<body>
<script type=”text/javascript”>
//more code here
</script>
</body>
</html>
This simple HTML page contains a single <script/> element in the body of the document. The
JavaScript code contained in this script block is generated by the PHP application, calling either
checkUsername_callBack() or checkEmail_callBack() in the visible frame and passing
available or not available as their arguments. Therefore, the following HTML document is a
valid response from the PHP application:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN”
“http://www.w3.org/TR/html4/strict.dtd”>
<html>
<head>
<title>Returned Data</title>
</head>
<body>
<script type=”text/javascript”>
top.checkUsername_callBack(“available”, “some_username”);
</script>
</body>
</html>
The user name is available in this sample response. Therefore, the HTML page calls the
checkUsername_callBack() function in the parent window and passes the string available.
Also, the searched user name (or e-mail) is sent back to the client because the client application will
display the correct user name or e-mail when the Back or Forward button is pressed. With the response
in this format, you can keep a good portion of the JavaScript code the same.
Try It Out Iframe Smart Form
The code for this revised smart form is very similar to the code used previously with the XMLHttpRequest
example. There are, however, a few changes. Open up your text editor and type the following:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN”
“http://www.w3.org/TR/html4/strict.dtd”>
<html>
<head>
<title>Form Field Validation</title>
Search WWH ::




Custom Search