Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

Writing ASP Chat using JavaScript and XML (Part 4)

, 21 Jan 2004
The last part of the ASP chat series. This article explains how to provide a chat with multiple rooms.
<%@LANGUAGE="JAVASCRIPT"%>
<html>
<head>
<title>Registration</title>
<!-- #INCLUDE FILE="INC/chatprocessing.asp" -->
<%
var nick, password, firstName, lastName, email;
nick = Request.Form("Nick");
password = Request.Form("Password");
firstName = Request.Form("FirstName");
lastName = Request.Form("LastName");
email = Request.Form("Email");

var strError = "";
if(nick.Count > 0) {
	var userID = registerUser(nick, password, firstName, lastName, email);
	if(userID == -1) {
		strError = "User already exists.";
	}
	else {
		var redirectTo = "default.asp?UserID=" + nick;
		Response.Redirect(redirectTo);
	}
}
%>
<script>
<!--
function onProcessRegister() {
	var isFilled = ((document.frmReg.FirstName.value != "") &&
		(document.frmReg.LastName.value != "") && 
		(document.frmReg.Nick.value != "") &&
		(document.frmReg.Email.value != "") &&
		(document.frmReg.Password.value != "") &&
		(document.frmReg.Password1.value != ""));
	
	var isEqualPasswords = 
		(document.frmReg.Password.value == document.frmReg.Password1.value);
	if(!isFilled) {
		alert("Fields not complete!");
	}
	else if(!isEqualPasswords) {
		alert("Passwords are not equal!");
	}
	else {
		document.frmReg.submit();
	}
}
//-->
</script>
</head>
<body>

<h1 align="center">Registration</h1>

<form id="frmReg" name="frmReg" action="register.asp" method="post">
<table align="center" border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><font color="#FF0000"><%=strError%>&nbsp;</font></td></tr>
<tr>
<td>First Name</td>
<td><input id="FirstName" name="FirstName" maxlength="100" value="<%=firstName%>"></td>
</tr>
<tr>
<td>Last Name</td>
<td><input id="LastName" name="LastName" maxlength="100" value="<%=lastName%>"></td>
</tr>
<tr>
<td>Nick</td>
<td><input id="Nick" name="Nick" maxlength="20" value="<%=nick%>"></td>
</tr>
<tr>
<td>Email</td>
<td><input id="Email" name="Email" maxlength="100" value="<%=email%>"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" id="Password" name="Password" maxlength="20"></td>
</tr>
<tr>
<td>Confirm password </td>
<td><input type="password" id="Password1" name="Password1" maxlength="20"></td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td colspan="2" align="right"><input type="button" value="Register" onClick="onProcessRegister()"></td></tr>
</table>
</form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Alexander Fedorenko
Web Developer
Ukraine Ukraine
Alexander Fedorenko is a professional C++ developer since 1996. He completed many custom and shareware projects. One of the successful projects is DevPlanner - tool for personal planning and time management.

| Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 22 Jan 2004
Article Copyright 2004 by Alexander Fedorenko
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid