PDA

View Full Version : Problems with Response.Write


newkid
11-11-2004, 09:21 PM
I have used code Similar to this before, but not inside a form (I numbered lines just to make it a bit easer to explain) every thing works except line # 11.

What I'm trying to do is take a True/False field from an AcessDB and display as Sent/Not Sent vice True/False or a check box, I dont want the field to be updated just displayed (like info in lines 3,4,5) and need sent/not sent instead of true/false.

Line #14 which displays True/False works fine
Line #13 which displays a check box works fine



Thanks for any help in advance
J.C.



1 <FORM method="POST" action="<%=MM_editAction%>" name="form1">
2 <DIV>
3 <STRONG>Call Date:</STRONG> <%=(rsProc.Fields.Item("CallDate").Value)%>
4 &nbsp;&nbsp;<STRONG>Call Time:</STRONG> <%=(rsProc.Fields.Item("CallTime").Value)%>
5 &nbsp;&nbsp;<STRONG>CCS Init:</STRONG> <%=(rsProc.Fields.Item("AnsweringService").Value)%>
6 </DIV>
7 <BR>
8 <DIV>
9 <STRONG>Info Sent:</STRONG>
10
11 <%If (CStr((rsProc.Fields.Item("InfoSent").Value)) = CStr("True")) Then Response.Write(" Sent") : Response.Write(" Not Yet")%>
12
13 <INPUT <%If (CStr((rsProc.Fields.Item("InfoSent").Value)) = CStr("True")) Then Response.Write("checked") : Response.Write("")%> name="InfoSent" type="checkbox" id="InfoSent" value="checkbox">
14 <%=(rsProc.Fields.Item("InfoSent").Value)%>
15
13 &nbsp;&nbsp;
14 <STRONG>Date Sent:</STRONG>
15 <INPUT name="SentDate" type="text" id="SentDate" value="<%= DoDateTime((rsProc.Fields.Item("SentDate").Value), 2, 1033) %>">
16 </DIV>
17 </form>

Roy Sinclair
11-12-2004, 04:12 PM
VBScript uses ":" to separate multiple statements on a single line, it is not treated as an "else". You're confusing your languages and line 13 can't be working correctly either for the same reason.

newkid
11-15-2004, 05:10 PM
Thanks Roy, back to basics, and need to pay attention to what I'm doing



<%If (CStr((rsProc.Fields.Item("InfoSent").Value)) = CStr("True")) Then
Response.Write(" Yes")
else
Response.Write(" Not Yet")
end If%>


and line 13 does just what I told it to do, but why I did 2 response writes I'll never know


<%If (CStr((rsProc.Fields.Item("InfoSent").Value)) = CStr("True")) Then Response.Write("checked") : Response.Write("")%>


was is just simply doing a
Response.write("checked")
Response.write(" ")
if value was true


I'm going to response write this one up to lack of coffee on a friday after-noon!!!!!!!!

Thanks again
J.C.