danblack30
MIS
I'm trying to format a textbody to include an approved with the time or just a not approved. I made an if then statement that uses a field from the recordset (approval) and sets it to the variable (variapproval), then I have a hidden field that's named testapproval and that value is the response.write from variapproval. The approval field is a radio button with two values (y,n). If y is checked and the form is submitted the email says approved (+ the time) if n is checked then submitted the email still says approved unless you submit a second time then it says not approved. I tried to do a response.write(variapproval) in the textbody but couldn't get it to work.
So do I try to get the response.write working or figure out how to get the hidden field to refresh correctly?
Here is the code (stripped down to make it easier to read)
<code>
<%
If Request.Form("submit").Count > 0 Then
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "CERF is complete"
objMessage.Sender = "Martin_Door_Intranet"
objMessage.to = "danblack@test.com"
objMessage.TextBody = vbCrLf & Request.Form("testapproval") or Response.write(variapproval)
objMessage.Configuration.Fields.Item _
(" = 2
objMessage.Configuration.Fields.Item _
(" = "mail"
objMessage.Configuration.Fields.Item _
(" = 25
objMessage.Configuration.Fields.Update
objMessage.Send
Set objMessage = Nothing
End If
%>
<table>
<%
Dim variapproval
variapproval = ", has Not been Approved at this time." & vbCrLf
If (Recordset1.Fields.Item("approval").Value = "y") Then
variapproval = ", has been Approved on " & FormatDateTime(Date(),2) & "." & vbCrLf
End If
%>
<tr>
<td width="632">
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form2" id="form2">
<table width="632" border="0">
<tr>
<td colspan="4">test <%= Response.write(variapproval)%> </td>
</tr>
<tr>
<td colspan="4"><textarea name="Reason_for_Request" cols="57" rows="4" id="Reason_for_Request"><%=(Recordset1.Fields.Item("Reason_for_Request").Value)%></textarea></td>
</tr>
<tr>
<td height="45"><input <%If (CStr((Recordset1.Fields.Item("approval").Value)) = CStr("y")) Then Response.Write("CHECKED") : Response.Write("")%> name="approval" type="radio" value="y"/>Approved<br />
<input <%If (CStr((Recordset1.Fields.Item("approval").Value)) = CStr("n")) Then Response.Write("CHECKED") : Response.Write("")%> name="approval" type="radio" value="n"/>Not Approved</td>
<td colspan="3">
<input type="submit" name="Submit" value="Update Record" />
<input type="hidden" name="testapproval" value="<%= Response.write(variapproval)%>">
<input type="hidden" name="MM_update" value="form2">
<input type="hidden" name="MM_recordId" value="<%= Recordset1.Fields.Item("Cerf_ID").Value %>">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</code>
Thanks,
Dan
So do I try to get the response.write working or figure out how to get the hidden field to refresh correctly?
Here is the code (stripped down to make it easier to read)
<code>
<%
If Request.Form("submit").Count > 0 Then
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "CERF is complete"
objMessage.Sender = "Martin_Door_Intranet"
objMessage.to = "danblack@test.com"
objMessage.TextBody = vbCrLf & Request.Form("testapproval") or Response.write(variapproval)
objMessage.Configuration.Fields.Item _
(" = 2
objMessage.Configuration.Fields.Item _
(" = "mail"
objMessage.Configuration.Fields.Item _
(" = 25
objMessage.Configuration.Fields.Update
objMessage.Send
Set objMessage = Nothing
End If
%>
<table>
<%
Dim variapproval
variapproval = ", has Not been Approved at this time." & vbCrLf
If (Recordset1.Fields.Item("approval").Value = "y") Then
variapproval = ", has been Approved on " & FormatDateTime(Date(),2) & "." & vbCrLf
End If
%>
<tr>
<td width="632">
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form2" id="form2">
<table width="632" border="0">
<tr>
<td colspan="4">test <%= Response.write(variapproval)%> </td>
</tr>
<tr>
<td colspan="4"><textarea name="Reason_for_Request" cols="57" rows="4" id="Reason_for_Request"><%=(Recordset1.Fields.Item("Reason_for_Request").Value)%></textarea></td>
</tr>
<tr>
<td height="45"><input <%If (CStr((Recordset1.Fields.Item("approval").Value)) = CStr("y")) Then Response.Write("CHECKED") : Response.Write("")%> name="approval" type="radio" value="y"/>Approved<br />
<input <%If (CStr((Recordset1.Fields.Item("approval").Value)) = CStr("n")) Then Response.Write("CHECKED") : Response.Write("")%> name="approval" type="radio" value="n"/>Not Approved</td>
<td colspan="3">
<input type="submit" name="Submit" value="Update Record" />
<input type="hidden" name="testapproval" value="<%= Response.write(variapproval)%>">
<input type="hidden" name="MM_update" value="form2">
<input type="hidden" name="MM_recordId" value="<%= Recordset1.Fields.Item("Cerf_ID").Value %>">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</code>
Thanks,
Dan