Hey there people,
Im trying to open a new window from an html page using the submit button on a form. This is not a problem, however i do not want the address bar to open and i want to control the size of the window. With my current code the new window will open (no address bar and the correct size). However my asp request.form are not picking up the sent information. Ive racked my brain to try to find a solution. please help!!!thanx in advance
heres the code for the initial html page:
thanx again
Im trying to open a new window from an html page using the submit button on a form. This is not a problem, however i do not want the address bar to open and i want to control the size of the window. With my current code the new window will open (no address bar and the correct size). However my asp request.form are not picking up the sent information. Ive racked my brain to try to find a solution. please help!!!thanx in advance
heres the code for the initial html page:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>hillcrest plus - request information</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="JavaScript" type="text/JavaScript">
//New window operation
function newWindow(hcresta){
hcrestaWindow = window.open(hcresta,'newWin','location=no,toolbar=no,width=500,height=500')
hcrestaWindow.focus()
}
// Valid info selection
function validinfo (info) {
if (info =="Make a Selection") {
return false
}
return true
}
function validother (other) {
if (other == "" && reqinfo.info.value == "Other") {
return false
}
return true
}
// validate name
function validname (custnme) {
if (custnme =="") {
return false
}
return true
}
// validate the address
function validaddress (custadd1) {
if (custadd1 =="") {
return false
}
return true
}
//validate the post code
function validpc (custpc) {
if (custpc =="") {
return false
}
return true
}
// Validate the telephone number
function validtel (custtel) {
if (custtel =="") {
return false
}
return true
}
//Check number
function isNum(passedVal) {
if (passedVal == "") {
return false
}
for (i=0; i<passedVal.length; i++) {
if (passedVal.charAt(i) < "0") {
return false
}
if (passedVal.charAt(i) > "9") {
return false
}
}
return true
}
// Validate the e mail address
function validEmail(custemail) {
invalidChars ="/:,;"
if (custemail == "") {
return false // Check not empty
}
for(i=0; i<invalidChars.lenght; i++) {
badChar = invalidChars.charAt(i)
if (custemail.indexof(badCar,0) > -1){
return false //Check for invalid charecters
}
}
atPos = custemail.indexOf("@",1)
if (atPos == -1){
return false //Check for One @ sign
}
if (custemail.indexOf("@",atPos+1) != -1) {
return false // check for more @ signs
}
fullstopPos = custemail.indexOf(".",atPos)
if (fullstopPos == -1) {
return false // check for a full stop after the @
}
if (fullstopPos+3 > custemail.length) {
return true // Check 2 charecters after the full stop
}
return true
}
//Execute the valitation function
function submitform(check) {
if(!validinfo(check.info.value)) {
alert("Plaese make a selection for the information you require")
check.info.focus()
return false
}
if(!validother(check.other.value)) {
alert("You have selected other information. Please provide more detail")
check.other.focus()
check.other.select()
return false
}
if(!validname(check.custnme.value)) {
alert("No Name Has Been Entered")
check.custnme.focus()
check.custnme.select()
return false
}
if (!validaddress(check.custadd1.value)) {
alert("No Address has been entered")
check.custadd1.focus()
check.custadd1.select()
return false
}
if (!validpc(check.custpc.value)) {
alert("No post code has been entered")
check.custpc.focus()
check.custpc.select()
return false
}
if(!validtel(check.custtel.value)) {
alert("No Telephone Number Has Been Entered")
check.custtel.focus()
check.custtel.select()
return false
}
if(!isNum(check.custtel.value)) {
alert("An invalid Telephone Number Has Been Entered")
check.custtel.focus()
check.custtel.select()
return false
}
if(!validEmail(check.custemail.value)) {
alert("No Email Address or An Invalid Email Has Been Entered")
check.custemail.focus()
check.custemail.select()
return false
}
return true
}
</script>
</head>
<body link="#0094c2" alink="#0094c2" vlink="0094c2">
<font face="Helvetica Light" color="##0094C2" pointsize="15">
<table align="center" border="0">
<tr><td><p><img src="images/serv.gif" /></p></td></tr>
<tr><td><p>Please make a selection from the list below and enter your details</p>
<form action="javascript:newWindow('[URL unfurl="true"]http://www.pjosiah.co.uk/hillcrest/reqinfo.asp')"[/URL] method="post" name="reqinfo" class="service" id="reqinfo" onSubmit="return submitform(this)">
<p>
I would like more information on <select name="info">
<option selected value="Make a Selection">Make a Selection</option>
<option value="Accupunture">Accupunture</option>
<option value="Chiropody">Chiropody</option>
<option value="Travel Heath Services">Travel Heath Services</option>
<option value="Blood Pressure Monitoring">Blood Pressure Monitoring</option>
<option value="Chinese Herbal Therapy">Chinese Herbal Therapy</option>
<option value="Prescription Collection service">Prescription Collection Service</option>
<option value="Ayurvedic">Ayurvedic</option>
<option value="Smoking Cessation">Smoking Cessation services</option>
<option value="Chiropractic">Chiropractic</option>
<option value="Other">Other</option>
</select> hillcrest service.
</p></td></tr>
<tr><td><p>If other, please provide details <input type="text" name="other" value=""></p></td></tr>
<tr><td><p>
<table border="0">
<tr>
<td>Name</td>
<td><input type="text" name="custnme">*</td>
</tr>
<tr>
<td>Address</td>
<td><input type="text" name="custadd1">*</td>
</tr>
<tr>
<td></td>
<td><input type="text" name="custadd2"></td>
</tr>
<tr>
<td>Post Code</td>
<td><input type="text" name="custpc">*</td>
</tr>
<tr>
<td>Telephone Number</td>
<td><input type="text" name="custtel">*</td>
</tr>
<tr>
<td>Email Address</td>
<td><input type="text" name="custemail">*</td>
</tr>
<tr>
<td><input name="reset form" type="reset" value="Reset Form"></td>
<td><input name="Submit" type="submit" value="Submit Your Reqest"></td>
</tr>
</table>
</p></td></tr>
</form>
<tr><td><p>Please note fields marked with an asterix (*) are compulsary.</p></td></tr>
<tr><td><p><img src="images/closewin.gif" border="0" usemap="#closewindow" />
<map name="closewindow" id="closewindow">
<area shape="rect" coords="52,24,200,52" onClick="javascript:self.close();" />
</map>
</p></td></tr>
</table>
</font>
</body>
</html>