CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Checkbox value & CDONTS?

Print topic Send  topic

Author Message
Sean

Posts: 39
Posted: 07/22/2004, 7:02 AM

I have a form that has several checkboxes. The values of the checkboxes are either "Yes" or "No". When the form submits, it enters these values into the Access database fine, but the email doesn't show a value (it leaves it blank) for the checkboxes only.

Is there something with checkbox values that doesn't tranfer to email?

Here is the code for my After Insert email event.
----------------------------------------------------------------------
With CreateObject("CDONTS.NewMail")
.From = "ServiceOrder@domain.com"
.To = "sean@domain.com"
.Subject = "Service Order"
.Body = "Title Service Order" & vbCrLf _
& vbCrLf _
& "Please indicate type of work requested" & vbCrLf _
& "----------------------------------------------------------------" & vbCrLf _
& OrderForm.TypeOfWorkAbstracters.Text & " : Checkbox Value" & vbCrlf _
& OrderForm.TypeOfWorkTitleInsurance.Text & " : Checkbox Value" & vbCrlf _
& OrderForm.TypeOfWorkTaxCertificate.Text & " : Checkbox Value" & vbCrlf _
& OrderForm.TypeOfWorkOther.Text & " : Checkbox Value"
.BodyFormat = 1
.MailFormat = 0
.Send
End With
View profile  Send private message
dataobjx


Posts: 181
Posted: 07/22/2004, 7:16 AM

Add These To Functions To Your _Events Page

Function getCheckBoxValue(sVal, CheckedValue, UnCheckedValue, sType)
If isempty(sVal) Then
If UnCheckedValue = "" Then
getCheckBoxValue = "Null"
Else
If sType = "Number" Or sType = "Integer" Then
getCheckBoxValue = UnCheckedValue
Else
getCheckBoxValue = "'" & Replace(UnCheckedValue, "'", "''") & "'"
End If
End If
Else
If CheckedValue = "" Then
getCheckBoxValue = "Null"
Else
If sType = "Number" Or sType = "Integer" Then
getCheckBoxValue = CheckedValue
Else
getCheckBoxValue = "'" & Replace(CheckedValue, "'", "''") & "'"
End If
End If
End If
End Function

Function GetParam(ParamName)
Dim Param

If Request.QueryString(ParamName).Count > 0 Then
Param = Request.QueryString(ParamName)
ElseIf Request.Form(ParamName).Count > 0 Then
Param = Request.Form(ParamName)
Else
Param = ""
End If
If Param = "" Then
GetParam = Empty
Else
GetParam = Param
End If
End Function


To get the value of each checkbox make the following call

Dim chkTypeOfWorkAbstracters
Dim chkTypeOfWorkTitleInsurance
Dim chkTypeOfWorkTaxCertificate
Dim chkTypeOfWorkOther

chkTypeOfWorkAbstracters = getCheckBoxValue(GetParam("chk_TypeOfWorkAbstracters"), "1", "0", "Integer")
chkTypeOfWorkTitleInsurance = chkTypeOfWorkAbstracters = getCheckBoxValue(GetParam("chk_TypeOfWorkTitleInsurance"), "1", "0", "Integer")
chkTypeOfWorkTaxCertificate = getCheckBoxValue(GetParam("chk_TypeOfWorkTaxCertificate"), "1", "0", "Integer")
chkTypeOfWorkOther = getCheckBoxValue(GetParam("chk_TypeOfWorkOther"), "1", "0", "Integer")

Rename chk_TypeOfWorkAbstracters, chk_TypeOfWorkTitleInsurance, chk_TypeOfWorkTaxCertificate, chk_TypeOfWorkOther to the actual names that you've given your check boxes respectively.

Modify you code to this...

With CreateObject("CDONTS.NewMail")
.From = "ServiceOrder@domain.com"
.To = "sean@domain.com"
.Subject = "Service Order"
.Body = "Title Service Order" & vbCrLf _
& vbCrLf _
& "Please indicate type of work requested" & vbCrLf _
& "----------------------------------------------------------------" & vbCrLf _
& OrderForm.TypeOfWorkAbstracters.Text & " : " & chkTypeOfWorkAbstracters & vbCrlf _
& OrderForm.TypeOfWorkTitleInsurance.Text & " : " & chkTypeOfWorkTitleInsurance & vbCrlf _
& OrderForm.TypeOfWorkTaxCertificate.Text & " : " & chkTypeOfWorkTaxCertificate & vbCrlf _
& OrderForm.TypeOfWorkOther.Text & " : " & chkTypeOfWorkOther
.BodyFormat = 1
.MailFormat = 0
.Send
End With

_________________
www.DataObjx.net
www.mydigitalapps.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.