squirleegirl
Programmer
I'm not really sure if I should've posted this in another forum, but here goes anyways.
I have an application that users account for time in. There are several comment areas for them to explain downtime or whatever. In order to make the report look cleaner, we wanted standardized comments. So, several of the time entry blocks have an onChange statement in them to insert the generic statement for that area in appropriate comment box.
Problem: The database does not reflect the new comments. The record in the db shows the id, date, and whatever does not go through a javascript onChange function when the Save Record button is clicked. Now, if I clicked the Save button again, it would update the db with the comments.
I checked the insert query and it works fine. I can cut it out directly and paste it into sqlserver and it inserts the record with all of the correct comments. I have assumed the problem is somewhere with the javascript since this problem doesn't happen on the comments not run through the javascript functions.
Wierd thing, if I just do a Save Record where it enters the half record into the database and then pull a report, the comments are there.
There are 2 pages with 5 different comment sections that are run through javascript and they all act this way. Both of the comment sections that don't through javascript work fine.
I don't know if this is an actual problem with javascript or asp getting the information back from it.
Here is one of the javascript onChange functions:
function CDT(v) {
document.SaveForm.CDTComments.value += "\nTraining lost to unscheduled maintenance due to (" + v + " hours)"
}
Here is the block that activates the onChange:
<TR><TD><FONT face='Arial' size=1><STRONG>UNSCHEDULED MAINTENANCE</TD><TD><FONT face='Arial' size=1>(HRS)</TD>
<%Counter = 1
Do While Not rs.EOF
sqlText= SQLQuery
Set rs2 = oConn.Execute(SqlText)
If rs2.EOF then%>
<TD><FONT face='ARial' size=1><INPUT type=text value='0.0' style='FONT-SIZE: xx-small' name='MaintenanceUnScheduledCharge<%=Counter%>' onChange='CDT(this.value)'></TD>
<%Else%>
<TD><FONT face='ARial' size=1><INPUT type=text value='<%=rs2("fldUnschedMaintcharge")%>' style='FONT-SIZE: xx-small' name='MaintenanceUnScheduledCharge<%=Counter%>' onChange='CDT(this.value)'></TD>
<%End If
Counter = Counter + 1
rs.movenext
Loop
rs.movefirst
Counter = 1%>
Here is the code that is run when the user clicks Save:
varCDTComments = Request.Form("CDTComments")
varCDTComments = unQuote(varCDTComments)
If Counter = 0 then
sqlText="INSERT QUERY"
Set rs3 = oConn.Execute(sqlText)
Else
sqlText = "UPDATE QUERY"
Set rs3 = oConn.Execute(sqlText)
End If
Like I said, I have double checked the insert query, the request.form, and the unQuote function and they all are functioning correctly. I don't know javascript well at all and this is driving me nuts!
Thanks for any help!
I have an application that users account for time in. There are several comment areas for them to explain downtime or whatever. In order to make the report look cleaner, we wanted standardized comments. So, several of the time entry blocks have an onChange statement in them to insert the generic statement for that area in appropriate comment box.
Problem: The database does not reflect the new comments. The record in the db shows the id, date, and whatever does not go through a javascript onChange function when the Save Record button is clicked. Now, if I clicked the Save button again, it would update the db with the comments.
I checked the insert query and it works fine. I can cut it out directly and paste it into sqlserver and it inserts the record with all of the correct comments. I have assumed the problem is somewhere with the javascript since this problem doesn't happen on the comments not run through the javascript functions.
Wierd thing, if I just do a Save Record where it enters the half record into the database and then pull a report, the comments are there.
There are 2 pages with 5 different comment sections that are run through javascript and they all act this way. Both of the comment sections that don't through javascript work fine.
I don't know if this is an actual problem with javascript or asp getting the information back from it.
Here is one of the javascript onChange functions:
function CDT(v) {
document.SaveForm.CDTComments.value += "\nTraining lost to unscheduled maintenance due to (" + v + " hours)"
}
Here is the block that activates the onChange:
<TR><TD><FONT face='Arial' size=1><STRONG>UNSCHEDULED MAINTENANCE</TD><TD><FONT face='Arial' size=1>(HRS)</TD>
<%Counter = 1
Do While Not rs.EOF
sqlText= SQLQuery
Set rs2 = oConn.Execute(SqlText)
If rs2.EOF then%>
<TD><FONT face='ARial' size=1><INPUT type=text value='0.0' style='FONT-SIZE: xx-small' name='MaintenanceUnScheduledCharge<%=Counter%>' onChange='CDT(this.value)'></TD>
<%Else%>
<TD><FONT face='ARial' size=1><INPUT type=text value='<%=rs2("fldUnschedMaintcharge")%>' style='FONT-SIZE: xx-small' name='MaintenanceUnScheduledCharge<%=Counter%>' onChange='CDT(this.value)'></TD>
<%End If
Counter = Counter + 1
rs.movenext
Loop
rs.movefirst
Counter = 1%>
Here is the code that is run when the user clicks Save:
varCDTComments = Request.Form("CDTComments")
varCDTComments = unQuote(varCDTComments)
If Counter = 0 then
sqlText="INSERT QUERY"
Set rs3 = oConn.Execute(sqlText)
Else
sqlText = "UPDATE QUERY"
Set rs3 = oConn.Execute(sqlText)
End If
Like I said, I have double checked the insert query, the request.form, and the unQuote function and they all are functioning correctly. I don't know javascript well at all and this is driving me nuts!
Thanks for any help!