Hi
I am quite new to ASP and cannot get a form to update my db.
I can retrieve and display the data, but I cannot add or edit.
I have a form that calls a Javascript to validate the data, I then want to set the fields to the new values entered, but I am clearly doing something wrong and it probably very simple! I suspect I cannot use this code from within the Javascript, but I cannot work out how to call from the submit button, then validate the data and then save the record.
I have included a simplified code and removed the add functionality, hopefully this demostrates what I am foolishly trying to do!:
function f_Submit(sAction){
var strValid;
strValid = "";
if ( document.frmCAFDel.Column1.value == "") {
strValid = "Column 1 cannot be blank.\n";
}
if (strValid == "") {
return true;
}
else {
alert(strValid);
return false;
}
<%
strSql = "SELECT * FROM MYTABLE WHERE MYKEY = '" & strMyKey & ";"
Set rsDD = Server.CreateObject("ADODB.Recordset")
rsDD.Open strSql,objConn,adOpenForwardOnly,adLockOptimistic, adCmdText
if not rsDD.BOF and not rsDD.EOF then
rsDD.MoveFirst
rsDD("column1") = strColumn1
rsDD.Update
end if
' Close rs.
rsDD.Close
Set rsDD = Nothing
%>
window.document.frmCAFDel.action = sAction;
window.document.frmCAFDel.submit();
}
Help me please.....