custom confirmation with CDOSYS (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


sarge -> custom confirmation with CDOSYS (11/8/2007 20:06:48)

'Lo all-

I have a form that writes to an Access database, and the form has a custom confirmation page.
Each field that I've specified on the confirmation page (using the Frontpage INSERT > Web component... etc.) seems to generate a 'webbot'. All of that works fine.

Now I want to extend the functionality a bit, by sending an email from the confirmation page, using CDOSYS. I've used CDOSYS before... no problem.

My question is - How/where do I store these webbot values, so that I can use them in CDOSYS?

Thanks,
Sarge




William Lee -> RE: custom confirmation with CDOSYS (11/9/2007 2:26:36)

Try capturing the field with this FP function:

<%FP_Confirmfield("FieldName")%>


where you substitute FieldName with the actual name of the confirmation field.

Just put that code on the confirmation page and see if it returns anything.








sarge -> RE: custom confirmation with CDOSYS (11/9/2007 4:22:37)

Yip, that worked beautifully.
Many thanks, William.
[:)]




William Lee -> RE: custom confirmation with CDOSYS (11/9/2007 11:04:11)

Say, sarge, do you think I can visit your pages when you have completed them?
I'm curious how you are doing this way.





sarge -> RE: custom confirmation with CDOSYS (11/10/2007 10:23:08)

Hi William-
Although I can capture the value by putting it in a textbox:
<input type="text" name="Aname" value="<%FP_Confirmfield("A_name")%> ".....
I don't know how to store this value for CDOSYS.
ASP won't let me do this as in-line code:
<%
.
.
strBody = "name = " & FP_Confirmfield("A_name")
.
.
%>

Trouble is, I just don't know enough about ASP.
Can you please point me in the right direction?
Thanks,
Sarge




William Lee -> RE: custom confirmation with CDOSYS (11/10/2007 20:05:10)

It could be due to where you put FP_ConfirmField("A_name") and CDOSYS codes, whether you put it before or after the webbot confirmation fields.

That function is only available after the webbot has parsed, putting before the webbot may not get the desired result.

Can you post the code on the confirmation page.





sarge -> RE: custom confirmation with CDOSYS (11/10/2007 23:48:09)

Hi William-
I've uploaded it to the server, so you can try it out:

Click here to fill in the form & post it.




William Lee -> RE: custom confirmation with CDOSYS (11/11/2007 0:01:40)

Whats on line 212?

Looks like you need to post the whole code or email me.

Good looking form[:)]




sarge -> RE: custom confirmation with CDOSYS (11/11/2007 6:27:27)

I never know how to line up the line number in an error with the line numbers in Frontpage, but I've established that the error line is:
strBody = strBody & "ID = " & FP_Confirmfield("A_ID") & Chr(13)&Chr(10)
This is taken out of context, as it's part of the CDOSYS code, so here's the whole thing... [;)]


<%
'===================================================================
' Send the results to e-mail.
' Use CDOSYS to create and send a message based on information
' entered into the form. The following lines compose and send
' the e-mail.
'===================================================================

'====================================================================
' Set up variables:
' myCDOSYSMail = A CDOSYS mail object.
' strFrom = A string containing the source e-mail address.
' strTo = A string containing the destination e-mail address.
' strSubject = A string containing the subject of the e-mail.
' strBody = A string containing the body of the e-mail.
'====================================================================
Dim myCDOSYSMail
Dim strFrom
Dim strTo
Dim strSubject
Dim strBody

strFrom="admin@debtdistress.info"
strTo="central@debtdistress.info"
strSubject="NEW ASSOCIATE member - ONLY A TEST" & Request.Form("A_ID")
strBody="We have a NEW ASSOCIATE MEMBER " & Chr(13)&Chr(10)&Chr(10)

strBody = strBody & "ID = " & FP_Confirmfield("A_ID") & Chr(13)&Chr(10)
strBody = strBody & "name = " & FP_Confirmfield("A_name") & Chr(13)&Chr(10)
strBody = strBody & "company = " & FP_Confirmfield("A_company") & Chr(13)&Chr(10)
strBody = strBody & "address = " & FP_Confirmfield("A_address") & Chr(13)&Chr(10)
strBody = strBody & "phone = " & FP_Confirmfield("A_phone") & Chr(13)&Chr(10)
strBody = strBody & "email address = " & FP_Confirmfield("A_email") & Chr(13)&Chr(10)&Chr(10)

strBody = strBody & "THIS IS ONLY A TEST" & Chr(13)&Chr(10)&Chr(10)
'====================================================================
' The SET statement creates the CDOSYS mail object in preparation
' for sending the e-mail message.
'====================================================================
Set myCDOSYSMail = CreateObject("CDO.Message")
myCDOSYSMail.From = strFrom
myCDOSYSMail.To = strTo
myCDOSYSMail.Subject = strSubject
myCDOSYSMail.TextBody = strBody
'====================================================================
' The following line sends the mail message using the source e-mail,
' destination e-mail, subject, and body that were defined earlier.
'====================================================================
myCDOSYSMail.Send

'=== Set the CDOSYS mail object to NOTHING to free resources.
Set myCDOSYSMail = Nothing

%>





William Lee -> RE: custom confirmation with CDOSYS (11/11/2007 7:40:13)


quote:

ORIGINAL: sarge

I never know how to line up the line number in an error with the line numbers in Frontpage



Let you in this one tip. Copy and paste the code(ASP and HTML, everything) into the top cell of Excel and they're all appear with line numbers.

quote:



Set myCDOSYSMail = CreateObject("CDO.Message")


Change it to Set myCDOSYSMail = Server.CreateObject("CDO.Message")




sarge -> RE: custom confirmation with CDOSYS (11/11/2007 19:34:32)

If I just knew how to store the value of one of those textboxes - in a variable within the CDOSYS code - then that would do it...
[:-]




William Lee -> RE: custom confirmation with CDOSYS (11/11/2007 22:37:10)

Will it work if you try something like this before the CDOSYS

<%
A_name=FP_Confirmfield("A_name")

:
:
%>
and then use the var A_name in your CDOSYS code?




sarge -> RE: custom confirmation with CDOSYS (11/12/2007 4:52:08)

Nope. Have tried it both inside and outside CDOSYS. The only thing that seems to work is <%FP_Confirmfield("A_address")%> as an initial value in a textbox.
Is there not some way to get at this textbox value from within CDOSYS?

Why should this be such a ******* minefield?
[:-]




William Lee -> RE: custom confirmation with CDOSYS (11/12/2007 4:58:27)

Are you able to capture them like what you did with Request.Form("A_ID")?

Instead of using FP_Confirmfield("A_name") try to use Request.Form("A_name").





sarge -> RE: custom confirmation with CDOSYS (11/12/2007 6:23:40)

Nope. Request.Form doesn't seem to work for confirmation pages. [:-]




William Lee -> RE: custom confirmation with CDOSYS (11/12/2007 7:08:03)

Okay this will be the last foray into this minefield, if it doesn't work we'll have to retrace our steps adopt a different strategy. Try this before I suggest another approach, which is the commonly used method.

I checked the function FP_ConfirmField("FieldName") when the ConfirmationField webbot expands and it is as below:

Sub FP_ConfirmField(sField)
	On Error Resume Next
	Session("FP_OldCodePage") = Session.CodePage
	Session("FP_OldLCID") = Session.LCID
	Session.CodePage = 1252
	Session.LCID = 1033
	sOut = FP_SavedFields(sField)
	sOut = Replace(sOut,"&","^^@^^")
	sOut = Server.HTMLEncode(sOut)
	sOut = Replace(sOut,"^^@^^","&")
	Response.Write sOut
	Session.CodePage = Session("FP_OldCodePage")
	Session.LCID = Session("FP_OldLCID")
End Sub


There is a response.write statement inside the function and likely this is the cause for Type Mismatch error

There is a FP_SavedFields("FieldName") variable and we might be able to make use of it.
Suggest replace in the CDOSYS with FP_SavedFields("FieldName")




sarge -> RE: custom confirmation with CDOSYS (11/12/2007 7:58:28)

Success!! [:D]

That's good news for me, as I was otherwise faced with re-writing a large number of forms pages as long-hand INSERT statements followed by CDOSYS. Now I can just bolt CDOSYS onto the confirmation pages.
A general method of firing off form-related emails from a custom confirmation page is something really worth knowing.

William, you're a star. [;)]




William Lee -> RE: custom confirmation with CDOSYS (11/12/2007 8:05:08)


quote:

ORIGINAL: sarge

Success!! [:D]

That's good news for me, as I was otherwise faced with re-writing a large number of forms pages as long-hand INSERT statements followed by CDOSYS. Now I can just bolt CDOSYS onto the confirmation pages.
A general method of firing off form-related emails from a custom confirmation page is something really worth knowing.

William, you're a star. [;)]


You're no less than me [:)]
Kudos to you for attempting an unconventional but useful method.
We triumphed![sm=yupi3ti.gif]




blockhead -> RE: custom confirmation with CDOSYS (11/16/2007 14:08:04)

In response to post 9 - I have been wanting to try this for awhile now, but am having no luck.
I don't have any problem at all copying and pasting between Front Page HTML and notepad. When I try it with Excel 2003 however, it either pastes some of the formatted text, or nothing at all. What I have been doing is copying html in Front Page, and pasting into A1 in Excel - Is this correct way? If so, I'm missing something. Thanks in advance [:)]




William Lee -> RE: custom confirmation with CDOSYS (11/16/2007 18:36:29)

quote:

ORIGINAL: blockhead

In response to post 9 - I have been wanting to try this for awhile now, but am having no luck.

What I have been doing is copying html in Front Page, and pasting into A1 in Excel - Is this correct way? If so, I'm missing something. Thanks in advance [:)]


Right click on A1 and select Paste Special>Text

Edit: Oops, I just tried copying and paste special from FP into Excel, it doesn't work![:o]

It doesn't seem to work when there are HTML tags.

It does work for just those asp code that sarge posted and I can tell the line number just from Excel row numbers when the asp code is pasted.




William Lee -> RE: custom confirmation with CDOSYS (11/17/2007 6:26:05)


Better still, upgrade to Expressions Web.

EW has line numbers for easy reference [:)]




pd_it_guy -> RE: custom confirmation with CDOSYS (3/6/2008 13:41:40)

Mr. Lee,


I have been struggling with this very same problem for days now, and you have just solved it for me as well. Thanks so much for sharing your wisdom.




William Lee -> RE: custom confirmation with CDOSYS (3/9/2008 22:10:58)

quote:

I have been struggling with this very same problem for days now, and you have just solved it for me as well. Thanks so much for sharing your wisdom.



[:)]
I read your other thread and am happy for you that this method works the way you wanted.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
9.399414E-02