Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using asp code within vbscript

Status
Not open for further replies.

Programming2007

Programmer
Nov 10, 2006
24
US
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
 
Since you are redirecting to another page, nothing from this page will be sent to the client computer, which means nothing client side will ever exist. The ASP code is processed on the server, before the page is sent to the client. Once the page is in the client's browser, the ASP no longer exists.

Lee
 

ASP ==> Active SERVER Pages

Do your checking clientside use JS, then redirect to another asp page to do your database stuff and email, then redirect from there to your next visible page, email confirmation or whatever.

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top