Thanks for the responses..
The reason why I don't think its submitting is because when I run SQL
profiler, on a normal Submit, I can see the stored procedure hit the db
and when it doesnt seem to work, the form looks like it submits but then
the SP never gets triggered(this happens about 2 out of three tries when
only the checkbox is changed). Honestly, I'm not actually sure that is
not submitting, just that its not firing off the SP unless one of the
text fields is modified.
I have cut and pasted the code below. Thanks again...
<!-- #INCLUDE FILE="hs.vbs" -->
'LOCAL
<%
session("mode")="update"
'add a record
IF Request.form("SubmitType")="add" then
'set edit mode
session("mode")="add"
'connect to the database
'on error resume next
set con = server.createobject("adodb.connection")
con.open application("connect") & session("database") & ";"
'insert new record
sql="spInsertContact "
for i=1 to 6
this="new"&i
sql=sql & "'" & trim(request.form(this)) & "',"
next
sql= sql & "'" & trim(request.form("new7")) &"'"
'execute
con.execute(sql)
'close ADO objects
'rs.close
con.close
'set rs = nothing
set con=nothing
sql=""
end if
'edit a record
if Request.form("SubmitType")="edit" then
'set edit mode
session("mode")="edit"
end if
'update a record
IF Request.form("SubmitType")="update" then
'set edit mode
session("mode")="update"
'connect to the database
'on error resume next
set con = server.createobject("adodb.connection")
con.open application("connect") & session("database") & ";"
SQL="spUpdateContact " & "'" & session("thisRecord") &"',"
for i=1 to 6
this="new"&i
sql=sql & "'" & trim(request.form(this)) & "',"
next
sql= sql & "'" & trim(request.form("new7")) &"',"
sql= sql & "'" & trim(request.form("new8")) &"'"
con.execute(sql)
'close ADO objects
con.close
set con=nothing
sql=""
end if
'delete a record
IF Request.form("SubmitType")="delete" then
'set edit mode
session("mode")="delete"
'connect to the database
'on error resume next
set con = server.createobject("adodb.connection")
con.open application("connect") & session("database") & ";"
SQL="spDelContact '" & session("thisRecord") &"'"
con.execute(sql)
'close ADO objects
con.close
set con=nothing
end if
IF Request.form("SubmitType")="cancel" then
'set edit mode
session("mode")="cancel"
end if
%>
<%
function setupForm()
dim htmlcode
if session("mode") ="edit" then
session("thisRecord")= request.form("contact")
'on error resume next
set con = server.createobject("adodb.connection")
con.open application("connect") & session("database") & ";"
htmlcode=htmlcode&"<table width='400' class='text'><tr>"
SQL=("spContactInfoEdit '" & session("thisRecord") &"'")
set rs = con.execute(SQL)
if not err.number=0 then
Response.Write "Error:"& err.Description
err.clear()
Response.End
end if
IF rs.eof = FALSE THEN
alldata= rs.getrows
numcols=ubound(alldata,1)
numrows=ubound(alldata,2)
htmlcode=htmlcode&"<td class='boldtext' style='text-align:left;'
width='120'> "&RS(0).name&" :</td>"
htmlcode=htmlcode&"<td width='150' class='text'><input type='text'
class='text' name='new1' value='" & alldata(0,0) &"'
maxlength='50'></td><tr>"
htmlcode=htmlcode&"<td class='boldtext' style='text-align:left;'
width='120'> "&RS(1).name&" :</td>"
htmlcode=htmlcode&"<td width='150' class='text'><select name='new2'>"
thischoice=fetchSQL("select [contact type],[contact type id] from
[contact list] order by [contact type id]")
for i=0 to ubound(thisChoice,2)
htmlcode=htmlcode & "<OPTION Value='"&thisChoice(1,i) &"'"
if alldata(1,0)=thisChoice(1,i) then
htmlcode=htmlcode&" SELECTED"
end if
htmlcode=htmlcode&" >"&thisChoice(0,i)&"</OPTION>"& vbcrlf
next
htmlcode=htmlcode&"</select> </td></tr>"& vbcrlf
htmlcode=htmlcode&"<td class='boldtext' style='text-align:left;'
width='120'> "&RS(2).name&" :</td>"
htmlcode=htmlcode&"<td width='150' class='text'><input type='text'
class='text' name='new3' value='" & alldata(2,0) &"'
maxlength='20'></td><tr>"
htmlcode=htmlcode&"<td class='boldtext' style='text-align:left;'
width='120'> "&RS(3).name&" :</td>"
htmlcode=htmlcode&"<td width='150' class='text'><input type='text'
class='text' name='new4' value='" & alldata(3,0) &"'
maxlength='20'></td><tr>"
htmlcode=htmlcode&"<td class='boldtext' style='text-align:left;'
width='120'> "&RS(4).name&" :</td>"
htmlcode=htmlcode&"<td width='150' class='text'><input type='text'
class='text' name='new5' value='" & alldata(4,0) &"'
maxlength='20'></td><tr>"
htmlcode=htmlcode&"<td class='boldtext' style='text-align:left;'
width='120'> "&RS(5).name&" :</td>"
htmlcode=htmlcode&"<td width='150' class='text'><input type='text'
class='text' name='new6' value='" & alldata(5,0) &"'
maxlength='20'></td><tr>"
htmlcode=htmlcode&"<td class='boldtext' style='text-align:left;'
width='120'> "&RS(6).name&" :</td>"
htmlcode=htmlcode&"<td width='150' class='text'><input type='text'
class='text' name='new7' value='" & alldata(6,0) &"'
maxlength='20'></td><tr>"
htmlcode=htmlcode&"<td class='boldtext' style='text-align:left;'
width='120'> "&RS(7).name&" :</td>"
htmlcode=htmlcode&"<td width='150' class='text'><input
type='checkbox' causesvalidation='true' name='new8' value='" &
alldata(7,0) & "'"
'check for checked value
if alldata(7,0)="*" then
htmlcode=htmlcode&" CHECKED"
end if
htmlcode=htmlcode&" onclick='toggle(8)'></td><tr>"
rs.close
con.close
set rs = nothing
set con = nothing
htmlcode=htmlcode&"<td colspan='2' align='center'>"
htmlcode=htmlcode&"<input type='button' value='Update' name='update'
onclick='updateRecord()' style='font: 8 pt Verdana, San-Serif;
background: white;'> "
'htmlcode=htmlcode&"<input type='button' value='Delete' name='delete'
onclick='deleteRecord()' style='font: 8 pt Verdana, San-Serif;
background: white;'> "
htmlcode=htmlcode&"<input type='button' value='Cancel' name='cancel'
onclick='cancelIt()' style='font: 8 pt Verdana, San-Serif; background:
white;'> "
htmlcode=htmlcode&"</td></tr>"
else
response.write "No data Returned"
end if
else
'setup table
htmlcode=htmlcode&"<table width='400' class='text'>"
'where [name]='" & session("thisServer") & "'")
'setup URL List
thisRS=fetchSQL("select distinct a.contact as 'Name', a.[contact id]
from [contact info] a join contacts b on b.[contact id]=a.[contact id]
join [contact list] c on a.[contact type] = c.[contact type id] join
[url list] d on d.[url id]=b.[url id] where b.[url id] in (select a.[url
id] from [url list] a where a.[url id] in ( select a.[url id] from urls
a join [Server info] b on b.[server id]=a.[server id] where b.name='" &
session("thisServer") & "'))")
htmlcode=htmlcode&"<tr><td width='150'><b> Contacts: </b></td><td
width='200' ><SELECT Name='Contact' onchange='editRecord()'> "
htmlcode=htmlcode & "<OPTION Value=''>--Choose Contact--</OPTION>"&
vbcrlf
for i=0 to ubound(thisRS,2)
htmlcode=htmlcode & "<OPTION Value="&thisRS(1,i)
htmlcode=htmlcode&">"&thisRS(0,i)&"</OPTION>"& vbcrlf
next
htmlcode=htmlcode&"</select></td></tr></table><br>"& vbcrlf
'setup input fields
htmlcode=htmlcode&"<table width='400'><tr><td class='boldtext'
style='text-align:left;' width='120'> Contact Name :</td>"
htmlcode=htmlcode&"<td width='150'><input type='text' class='text'
name='new1' value='' maxlength='20'></td></tr>"
htmlcode=htmlcode&"<td class='boldtext' style='text-align:left;'
width='120'> Contact Type :</td>"
htmlcode=htmlcode&"<td width='150' class='text'><select name='new2'>"
htmlcode=htmlcode&"<OPTION Value=''></OPTION>"& vbcrlf
'NOPE
thischoice=fetchSQL("select [contact type id],[contact type] from
[contact list] order by [contact type id]")
for i=0 to ubound(thisChoice,2)
htmlcode=htmlcode & "<OPTION Value='"&thisChoice(0,i)
htmlcode=htmlcode&"'>"&thisChoice(1,i)&"</OPTION>"& vbcrlf
next
htmlcode=htmlcode&"</select> </td></tr>"& vbcrlf
htmlcode=htmlcode&"<td class='boldtext' style='text-align:left;'
width='120'> Office Phone :</td>"
htmlcode=htmlcode&"<td width='150'><input type='text' class='text'
name='new3' value='' maxlength='20'></td></tr>"
htmlcode=htmlcode&"<td class='boldtext' style='text-align:left;'
width='120'> Cell Phone :</td>"
htmlcode=htmlcode&"<td width='150'><input type='text' class='text'
name='new4' value='' maxlength='20'></td></tr>"
htmlcode=htmlcode&"<td class='boldtext' style='text-align:left;'
width='120'> Home Phone :</td>"
htmlcode=htmlcode&"<td width='150'><input type='text' class='text'
name='new5' value='' maxlength='20'></td></tr>"
htmlcode=htmlcode&"<td class='boldtext' style='text-align:left;'
width='120'> Pager :</td>"
htmlcode=htmlcode&"<td width='150'><input type='text' class='text'
name='new6' value='' maxlength='20'></td></tr>"
htmlcode=htmlcode&"<td class='boldtext' style='text-align:left;'
width='120'> Email Address :</td>"
htmlcode=htmlcode&"<td width='150'><input type='text' class='text'
name='new7' value='' maxlength='50'></td></tr>"
'primary section
htmlcode=htmlcode&"<td class='boldtext' style='text-align:left;'
width='120'> Primary Contact?</td>"
htmlcode=htmlcode&"<td width='150' class='text'><input type='checkbox'
causesvalidation='true' name='new8' value='' "
'check for checked value
if new8="*" then
htmlcode=htmlcode&" CHECKED"
end if
htmlcode=htmlcode&" onclick='toggle(8)'></td></tr>"
'primary section
' add control buttons
htmlcode=htmlcode&"<td colspan='2' align='center'>"
htmlcode=htmlcode&"<input type='button' value=' Add ' name='add'
onclick='addRecord()' style='font: 8 pt Verdana, San-Serif; background:
white;'> "
'htmlcode=htmlcode&"<input type='button' value=' Edit ' name='edit'
onclick='editRecord()' style='font: 8 pt Verdana, San-Serif; background:
white;'> "
htmlcode=htmlcode&"<input type='button' value='Close' name='cancel2'
onclick='self.close()' style='font: 8 pt Verdana, San-Serif; background:
white;'> "
htmlcode=htmlcode&"</td></tr>"
end if
set con = nothing
sql=""
'end table and form
htmlcode=htmlcode&"</table></form><br>"
response.write htmlcode
end function
%>
<html>
<head>
<title>Modify Contacts</title>
<link rel="stylesheet" href="hsdr.css">
<base target="main-bottom">
<script language="vbscript">
function addRecord()
'check for data
if NOT document.editcontacts.new1.value="" AND NOT
document.editcontacts.new2.value=""then
'check with the user
response=confirm("Add record?")
if response=true then
document.forms("editcontacts").SubmitType.value="add"
document.forms("editcontacts").submit()
end if
else
alert("Please fill-in required fields!")
end if
end function
function editRecord()
document.forms("editcontacts").SubmitType.value="edit"
document.forms("editcontacts").submit()
end function
function deleteRecord()
'check with the user
response=confirm("Delete record?")
if response=true then
document.forms("editcontacts").SubmitType.value="delete"
document.forms("editcontacts").submit()
end if
end function
function updateRecord()
'check with the user
response=confirm("Update record?")
if response=true then
document.forms("editcontacts").SubmitType.value="update"
document.forms("editcontacts").Submit()
window.opener.location.reload()
window.close
end if
end function
function cancelIt()
document.forms("editcontacts").SubmitType.value="cancel"
document.forms("editcontacts").submit()
end function
function toggle(this)
select case this
case 8
if document.editcontacts.new8.checked="false" then
document.editcontacts.new8.value="0"
else
document.editcontacts.new8.value="1"
end if
end select
end function
</script>
</head>
<body topmargin="0" leftmargin="5" >
<form name='editcontacts' action='editcontacts.asp' method='post'
target='_self'>
<input type='hidden' NAME='SubmitType' value=''>
<%=setupForm%>
<br>
</body>
</html>