Hi,

I have a piece of code above the head section of my asp page that sends a
text message when the page is submitted.

What I need is a checkbox that can switch off the code when no text message
is to be sent.

Any ideas anyone please? Code below.

Thanks in advance

Simon


' Sending SMS

'Dim sUrl
' Dim sAPI_ID, sPassword, sUsername, sMobileNo, sText
' Dim oXMLHTTP, sPostData, sResult
'
' sUrl = "http://xxxxxxxxxx"
' sAPI_ID = "xxxxxxx"
' sPassword = "xxxxxx"
' sUsername = "xxxxxxxxx"
' sMobileNo = "" & rsBooking.Fields("MOBILE_NO").Value
' sText = "Message: " & rsBooking.Fields("Message").Value & vbcrlf &
"Driver Name: " & rsBooking.Fields("DRIVER_NAME").Value & vbcrlf & _
' "Driver Mobile No: " &
rsBooking.Fields("DRIVER_MOBILE").Value & vbcrlf & "Vehicle: " &
rsBooking.Fields("DRIVER_VEHICLE").Value & vbcrlf & _
' "Registration: " & rsBooking.Fields("VEHICLE_REG").Value
' sPostData = "api_id=" & sAPI_ID
' sPostData = sPostData & "&user=" & sUsername
' sPostData = sPostData & "&password=" & sPassword
' sPostData = sPostData & "&to=" & sMobileNo
' sPostData = sPostData & "&text=" & sText
' Set oXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
'
' oXMLHTTP.Open "POST", sUrl, false
' oXMLHTTP.SetRequestHeader "Content-Type",
"application/x-www-form-urlencoded"
' oXMLHTTP.Send sPostData
'
' sResult = oXMLHTTP.responseText
' Set oXMLHTTP = NOTHING

' Response.Write("result=" & sResult & "&")

Re: Switch code off using checkbox by mr_unreliable

mr_unreliable
Thu May 11 11:57:46 CDT 2006

hi Simon,

Give your checkbox an "id".

The "Checked" property will tell you whether the checkbox is
checked or unchecked.

Use an if-statement to test whether the checkbox is checked.

if (document.getElementById("myCkBox").Checked) then ByPassCode()

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)


Simon Gare wrote:
> Hi,
>
> I have a piece of code above the head section of my asp page that sends a
> text message when the page is submitted.
>
> What I need is a checkbox that can switch off the code when no text message
> is to be sent.
>
> Any ideas anyone please? Code below.
>
> Thanks in advance
>
> Simon
>
>
> ' Sending SMS
>
> 'Dim sUrl
> ' Dim sAPI_ID, sPassword, sUsername, sMobileNo, sText
> ' Dim oXMLHTTP, sPostData, sResult
> '
> ' sUrl = "http://xxxxxxxxxx"
> ' sAPI_ID = "xxxxxxx"
> ' sPassword = "xxxxxx"
> ' sUsername = "xxxxxxxxx"
> ' sMobileNo = "" & rsBooking.Fields("MOBILE_NO").Value
> ' sText = "Message: " & rsBooking.Fields("Message").Value & vbcrlf &
> "Driver Name: " & rsBooking.Fields("DRIVER_NAME").Value & vbcrlf & _
> ' "Driver Mobile No: " &
> rsBooking.Fields("DRIVER_MOBILE").Value & vbcrlf & "Vehicle: " &
> rsBooking.Fields("DRIVER_VEHICLE").Value & vbcrlf & _
> ' "Registration: " & rsBooking.Fields("VEHICLE_REG").Value
> ' sPostData = "api_id=" & sAPI_ID
> ' sPostData = sPostData & "&user=" & sUsername
> ' sPostData = sPostData & "&password=" & sPassword
> ' sPostData = sPostData & "&to=" & sMobileNo
> ' sPostData = sPostData & "&text=" & sText
> ' Set oXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
> '
> ' oXMLHTTP.Open "POST", sUrl, false
> ' oXMLHTTP.SetRequestHeader "Content-Type",
> "application/x-www-form-urlencoded"
> ' oXMLHTTP.Send sPostData
> '
> ' sResult = oXMLHTTP.responseText
> ' Set oXMLHTTP = NOTHING
>
> ' Response.Write("result=" & sResult & "&")
>
>