Programming2007
Programmer
I have a submit button. When it is clicked then I want it to call asp code. It calls a vbscript sub.I don't know how to write the asp code within the script. Below is my code
........................................................
<tr><td><%=(vName)%></td><td><input type ="checkbox" ID="Checkbox2" NAME="chkEmail" value="<%=email%>" /></td><td><%=(phone)%></td><td><%=(points) & " Stars"%></td><td><%=formatnumber(totalDistance, 2)%>mi</td></tr>
<%Next %>
<tr>
<td><input type ="button" value =SUBMIT ID="Submit1" NAME="Submit1" onclick="vbscript: chkformemail()">
</tr>
</table>
</form>
<%
End If
End If%>
<SCRIPT language="vbscript">
Sub chkformemail()
If FRM_WO.chkEmail(0).checked=false and FRM_WO.chkEmail(1).checked =false and FRM_WO.chkEmail(2).checked=false and FRM_WO.chkEmail(3).checked=false and FRM_WO.chkEmail(4).checked=false Then
MsgBox("Please select a vendor email")
else
THIS IS WHERE I WANT TO CALL THE ASP CODE!!! End If
End Sub
</script>
THIS IS THE ASP CODE
<%ticketNumber =TICKET_ID
SQLStmt= "SELECT dbo.CUST_FILE.CUS_ADDR1, dbo.CUST_FILE.CUS_CITY, dbo.CUST_FILE.CUS_STATE, dbo.PROJECTS.TICKET_ID, dbo.PROJECTS.SCHED_START_DT, " & _
" dbo.PROJECTS.SCHED_COMP_DT, dbo.PROJECTS.PARENT, projects.cus_phone,dbo.PROJECTS.CUS_CONTACT, dbo.TICKETS.TASK " & _
" FROM dbo.CUST_FILE INNER JOIN " & _
" dbo.TICKETS ON dbo.CUST_FILE.MACNUM = dbo.TICKETS.MACNUM INNER JOIN " & _
" dbo.PROJECTS ON dbo.TICKETS.MACNUM = dbo.PROJECTS.MACNUM " & _
" and PROJECTS.SCHED_COMP_DT = '" & sched_comp_dt & "' " & _
"where tickets.ticket_id = '" &ticketNumber & "' "
Response.Write sqlSTMT
set rs = cnRL.Execute( SQLStmt)
if not rs.EOF then
ticketID = Rs("ticket_id")
sched_comp_dt = Rs("sched_comp_dt")
parent = Rs("parent")
address1 = Rs("CUS_ADDR1")
city = Rs("CUS_city")
state = Rs("CUS_state")
cus_contact = Rs("cus_contact")
cus_phone = Rs("cus_phone")
task = Rs("task")
Rs.movenext
set rs = nothing
cnRL.close
else
end if
Dim mail, strBody
strBody = vbcrLF & "******PLEASE SEE ATTACHED JOB SIGN OUT FORM *****" & vbcrLF
to from etc......
mail.Send()
Set mail = nothing
Response.Redirect("MailSent.asp")
%>
..................................................
Sorry that the code looks messy
........................................................
<tr><td><%=(vName)%></td><td><input type ="checkbox" ID="Checkbox2" NAME="chkEmail" value="<%=email%>" /></td><td><%=(phone)%></td><td><%=(points) & " Stars"%></td><td><%=formatnumber(totalDistance, 2)%>mi</td></tr>
<%Next %>
<tr>
<td><input type ="button" value =SUBMIT ID="Submit1" NAME="Submit1" onclick="vbscript: chkformemail()">
</tr>
</table>
</form>
<%
End If
End If%>
<SCRIPT language="vbscript">
Sub chkformemail()
If FRM_WO.chkEmail(0).checked=false and FRM_WO.chkEmail(1).checked =false and FRM_WO.chkEmail(2).checked=false and FRM_WO.chkEmail(3).checked=false and FRM_WO.chkEmail(4).checked=false Then
MsgBox("Please select a vendor email")
else
THIS IS WHERE I WANT TO CALL THE ASP CODE!!! End If
End Sub
</script>
THIS IS THE ASP CODE
<%ticketNumber =TICKET_ID
SQLStmt= "SELECT dbo.CUST_FILE.CUS_ADDR1, dbo.CUST_FILE.CUS_CITY, dbo.CUST_FILE.CUS_STATE, dbo.PROJECTS.TICKET_ID, dbo.PROJECTS.SCHED_START_DT, " & _
" dbo.PROJECTS.SCHED_COMP_DT, dbo.PROJECTS.PARENT, projects.cus_phone,dbo.PROJECTS.CUS_CONTACT, dbo.TICKETS.TASK " & _
" FROM dbo.CUST_FILE INNER JOIN " & _
" dbo.TICKETS ON dbo.CUST_FILE.MACNUM = dbo.TICKETS.MACNUM INNER JOIN " & _
" dbo.PROJECTS ON dbo.TICKETS.MACNUM = dbo.PROJECTS.MACNUM " & _
" and PROJECTS.SCHED_COMP_DT = '" & sched_comp_dt & "' " & _
"where tickets.ticket_id = '" &ticketNumber & "' "
Response.Write sqlSTMT
set rs = cnRL.Execute( SQLStmt)
if not rs.EOF then
ticketID = Rs("ticket_id")
sched_comp_dt = Rs("sched_comp_dt")
parent = Rs("parent")
address1 = Rs("CUS_ADDR1")
city = Rs("CUS_city")
state = Rs("CUS_state")
cus_contact = Rs("cus_contact")
cus_phone = Rs("cus_phone")
task = Rs("task")
Rs.movenext
set rs = nothing
cnRL.close
else
end if
Dim mail, strBody
strBody = vbcrLF & "******PLEASE SEE ATTACHED JOB SIGN OUT FORM *****" & vbcrLF
to from etc......
mail.Send()
Set mail = nothing
Response.Redirect("MailSent.asp")
%>
..................................................
Sorry that the code looks messy