Solved

Retrieve Form Values From A Web Bot

Posted on 2004-08-13
16
808 Views
Last Modified: 2008-01-09
Hello guys,

I did not author this site. Someone else in my company did. For some reason, they used Frontpage.. (probably because they DONT know what they are doing..)  I have a disdain for front page..

On the form, the Action is set to --Webbot-Self--

It is my understanding and experience that if you submit a form to say "Results.asp" you can retrive the values of the fields on the form using this syntax:

FName = Request.Form("FirstName")
LName = Request.Form("LastName")

Etc..

However, since the form is being submitted to --WebBot-Self--, the form values have magically disappeared into thin air along with any shred of respect i had for microsoft.

How do you retrive form values on the resultant targeted asp page once they have been submitted to a web bot?
I know they are there because further down on the form's autogenerated gibberish they are outputted to the document for review.  They are referenced like this:

<Webbot bot="xxx" s-value:xx.. >
(This is not exact.. im going from memory here..)

So, you can output values from the from by referencing the webbot object..
I need to get those into variables in my server side function.. (scroll back up)

How do i do it? Do i need to query a web bot object instead of the form object?
HELP!!! Its very late on friday and im cranky! I need a rum and coke.
-andrew

0
Comment
Question by:LunaSkye
  • 6
  • 4
  • 3
  • +1
16 Comments
 
LVL 11

Expert Comment

by:sciber_dude
ID: 11797013
If you are up for it, you could write your own ASP script and not depend on the Web-bot.

If not, you could open the form in MS FrontPage (design view) (Make sure you log in if it prompts you)
1. Right click on the form and select Form Properties
2. On the Form Properties Dialog Box, Select "Send to Database" radio button.
3. Click on the "Options" button.
4. On the "Options for saving results to Database" dialog box, select the appropriate Database connection string to use from the dropdown menu. (u need to know what the database is called)
5. Click the Update Database button.
6. Click OK twice. Save the form
7. And u are in business.

:) SD

PS: If you want to write ur own ASP, let me know and i will help you.
0
 
LVL 6

Author Comment

by:LunaSkye
ID: 11809631
Hmm..
I dont think writing my own asp to handle database updates is an option. I am not aversed to doing it, i have done extensive database work in vb, but i cant get into re-designing the page. If i change one thing, the change could propogate into a million other things that i didnt think about (or know about).

I was supposed to simply add in to the form submission page, an email notification to someone in my company.  I have done this. WHen the user presses "Submit" on the form, they are passed to a Confirmation.asp page. This page reviews their submissions with them, and it also has a little script <% .. %> in there to send email out to our marketing guy. It works fine, the only problem is that when i send this email out, i want to also include one or two basic paramters in the email, such as the submitters NAME, PHONE NUMBER, and EMAIL.  This information is not where i thought it would be, in the request object, it has disappeared.

I do not want to get into a total redisgn of the page or workings of the page. I just want to pull a value or two out of the magic web-bot.

Sciber_Dude:
What woudl i gain by examining the database connection and updating it? This sounds like design-time stuff.. i need to pull the values at run time. I need to find out at run time what the bot as used in its database update logic.

Help Please!
-andrew

ps.. happy monday
0
 
LVL 11

Expert Comment

by:sciber_dude
ID: 11811242
Hey Andrew -

Sorry! I guess I misread your question. I thought that the webbot wasnt functioning well. Your clarification today makes it clearer.

The problem with webbot code is that it doesnt have the traditional ASP code written into it.

~~~~~~~~~~~~~~~~~~~~~~~~~
Sample Webbot code
~~~~~~~~~~~~~~~~~~~~~~~~~
<!--webbot bot="SaveDatabase" SuggestedExt="asp" S-DataConnection="new_page_1" S-RecordSource="Results" U-Database-URL="http://www.servername.com/db/new_page_1.mdb" S-Builtin-Fields="REMOTE_HOST HTTP_USER_AGENT Timestamp REMOTE_USER" S-Builtin-DBFields="Remote_computer_name Browser_type Timestamp User_name" S-Form-Fields="PHONENUMBER EMAIL NAME" S-Form-DBFields="PHONENUMBER EMAIL NAME" -->

As I see it, there is no way you can edit this. If you want to add the email part, you will have to switch to writing your own code.

SD
0
 
LVL 6

Author Comment

by:LunaSkye
ID: 11811685
Ok, thats good... We are on the right track, im sorry i have been so cryptic here..
I have written some code to send an email, and it works. I am sending an email already.. The email says somethign like
"User has submitted information"
I want to say WHICH user has submitted it, and what their PHONE NUMBER is..
"User Joe Smith has submitted information. Telephone number is 555-5555" etc..
I will give you what i have, maybe this will help

IN THE ORIGINAL SUBMISSION FORM:
<form method="POST" action="contact_us.asp" name="FrontPage_Form1" webbot-action="--WEBBOT-SELF--">
          <!--webbot bot="SaveDatabase" suggestedext="asp" u-asp-include-url="_fpclass/fpdbform.inc" s-dataconnection="contact_us" s-recordsource="Results" u-database-url="fpdb/contact_us.mdb" u-confirmation-url="_archives/formresponse/formconfirmation.asp" u-validation-error-url="_archives/formresponse/formfailurevalidation.asp" s-builtin-fields="HTTP_USER_AGENT REMOTE_HOST Timestamp REMOTE_USER" s-builtin-dbfields="Browser_type Remote_computer_name Timestamp User_name" s-form-fields="MIDASBrochure LeakDetectionBrochure Province LeakDetectionCD RepContact MIDASUserGuide Title MailAddress2 GeneralInfo BLRBACScenarioBrochure Company MailList OPTIMASWebEx Fax City Email PowerSurgeSub OPTIMASAdminGuide MailAddress Phone FirstName Title1 ZipCode MIDASWebEx OPTIMASUserGuide Message LastName Ext State OPTIMASBrochure" s-form-dbfields="MIDASBrochure LeakDetectionBrochure Province LeakDetectionCD RepContact MIDASUserGuide Title MailAddress2 GeneralInfo BLRBACScenarioBrochure Company MailList OPTIMASWebEx Fax City Email PowerSurgeSub OPTIMASAdminGuide MailAddress Phone FirstName Title1 ZipCode MIDASWebEx OPTIMASUserGuide Message LastName Ext State OPTIMASBrochure" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include file="_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase" i-checksum="40548" endspan -->

you can see a page referenced here:
formconfirmation.asp
It is in THIS page that i am sending out my email..


IN CONFIRMATION PAGE:

<%
SUB sendmail( fromWho, toWho, Subject, Body )
DIM objCDO
DIM iConf
DIM Flds

Set objCDO = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")

Set Flds = iConf.Fields
With Flds
            .Item(cdoSendUsingMethod) = cdoSendUsingPort
            .Item(cdoSMTPServer) = "mail-fwd"
            .Item(cdoSMTPServerPort) = 25
            .Item(cdoSMTPconnectiontimeout) = 10
            .Update
End With

Set objCDO.Configuration = iConf

objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.TextBody = Body

objCDO.Send

END SUB

Dim fromWho
Dim toWho
Dim Subject
Dim Body

Dim FName
Dim LName
Dim Comp
Dim EMAddress
Dim PNumber

' FName = Trim(Request.Form("FirstName"))
' LName = Trim(Request.Form("LastName"))
' Comp = Trim(Request.Form("Company"))
' EMAddress = Trim(Request.Form("Email"))
' PNumber = Trim(Request.Form("Phone"))

fromWho = "XX@XX.com"
toWho = "XX@XX.com, XX@XX.com"
Subject = "Online Data Request"
' Body = "Requested By: " & FName & " " & LName & CrLf & "Company: " & Comp & CrLf & "Email: " & EMAddress & CrLf & "Phone: " & PNumber
Body = "Request Submitted Online.  Check the database for further information."

sendMail fromWho, toWho, Subject, Body

'Cleanup
Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
%>



You can see here, i have a function that i wrote which takes care of sending an email to a specified person (names have been changed to protect the innocent) when a submission is recieved.

I have 4 lines commented out.. trying to retrieve the values of the fields in the initial submission form.
These always come up empty.. i am wondering why? How do i get the values?
Further down the page, these values ARE spat out for viewing: Check this out:

<!--webbot bot="ConfirmationField" S-Field="FirstName" startspan --><%FP_ConfirmField("FirstName")%><!--webbot bot="ConfirmationField" i-checksum="28862" endspan -->&nbsp;
          <!--webbot bot="ConfirmationField" S-Field="LastName" startspan --><%FP_ConfirmField("LastName")%><!--webbot bot="ConfirmationField" i-checksum="17137" endspan --><br>
          <b>Title:</b>
          <!--webbot bot="ConfirmationField" S-Field="Title1" startspan --><%FP_ConfirmField("Title1")%><!--webbot bot="ConfirmationField" i-checksum="14563" endspan --><br>
          <b>Company:</b>
          <!--webbot bot="ConfirmationField" S-Field="Company" startspan --><%FP_ConfirmField("Company")%><!--webbot bot="ConfirmationField" i-checksum="15866" endspan --><br>


Ok, so how does THIS work? and how can i make it work for me?
0
 
LVL 6

Author Comment

by:LunaSkye
ID: 11811935
I just tried to enter this code.. replacing the commented out lines above:

 FName = FP_ConfirmField("FirstName")
 LName = FP_ConfirmField("LastName")
 Comp = FP_ConfirmField("Company")
 EMAddress = FP_ConfirmField("Email")
 PNumber = FP_ConfirmField("Phone")

However, this did not work.. i get an error:

Microsoft VBScript runtime error '800a000d'
Type mismatch: 'FP_ConfirmField'

This leads me to believe that perhaps FP_ConfirmField()  is an array, and i have to address its members using a long or integer value, not a text string.

Any help ?
0
 
LVL 19

Expert Comment

by:webwoman
ID: 11813064
Redo the form totally, get rid of the FP bots, and write your own form handler for it. You could probably do it in less time than you'll spend trying to make the FP code do what you want. ;-)
0
 
LVL 19

Expert Comment

by:webwoman
ID: 11813102
You DO NOT need to redesign the page to get rid of the FP bots, you don't need to rename it, you don't need to do anything to any other page in the site.

All you need to do is take out any reference to webbot, any FP specific lines, rename the fields (you don't even have to move them), and change the action of the form to your form handler.

Form handlers are pretty generic, you wouldn't need to do more than find one (there are tons out there), slightly modify it, test it to be sure it works, and you're done. You know vb, so the syntax should be familiar. It shouldn't take more than a few hours, at most.
0
 
LVL 6

Author Comment

by:LunaSkye
ID: 11813212
Thank you webwoman,

I am a hardcore vb database programmer at my company.  I am not the web programmer. I have done alot of web programming in the past so i know this stuff pretty well.

The issue is partially policital also.  If i come in and stomp all over her (the web girl) stuff and rip out her bots, and her database management stuff, I dont think it would go over too well.
I was commissioned to simply add a few lines of code to send an email out because she doesnt really know how to...  (She is a point and click front page person)  Barely knows what a "Tag" is..
I was hoping to just pull the name of the person out of the submission.  
I dont really want to get involved in how she did the page, i dont want ownership of it. I just want to send the email out with the name.
I personally hate front page because of this reason, it hides everythign under the surface and makes it impossible to pick it apart.  
I do all my web programming in notepad.

Is there NO other way to do this? Is there no easy way to just get the name?
Example:
Maybe put a hidden field in a 2nd form on the submission page, and submit both forms at once..
anything.. get creative.

or, if you think the re-write of the form handler without bots is the simplest way to do it, then maybe ill have to go that way.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 19

Assisted Solution

by:webwoman
webwoman earned 150 total points
ID: 11816259
>>I was commissioned to simply add a few lines of code to send an email out because she doesnt really know how to...

But the problem is that FP doesn't do that, and you can't do it without breaking FP. So if they want it done, they either do it right or don't do it at all.

You'll really do her a huge favor if you write a very simple form handler that she can use INSTEAD of the FP bots. If she doesn't understand what she's doing (and it sounds like she hasn't a clue), things are going to break all the time.

If you really don't want to redo things, you might want to explain that FP does things its own way, and unless they want the form/handlers redone, there's no way to do what they want.
0
 
LVL 13

Expert Comment

by:davidlars99
ID: 11816567
hi,
try to replace following code:

<form method="POST" id="FrontPage_Form1" name="FrontPage_Form1" actioncontact_us.asp" webbot-action="--WEBBOT-SELF--">

with

<form method="POST" id="FrontPage_Form1" name="FrontPage_Form1" action="_vti_bin/shtml.dll/contact_us.asp" webbot-action="--WEBBOT-SELF--">

see what happens and then we'll discuss more issues I'm sure we can solve this problem...

cheers!
 dave
0
 
LVL 13

Accepted Solution

by:
davidlars99 earned 150 total points
ID: 11817087
ok here's what you gonna do:

1) put all asp code which creates CDO.Message and sends email into new file and name it -confirm.asp- replace all "request.form" with " request.querystring" and save the file in the same directory as -contact_us.asp-

2) in -contact_us.asp- between "<head> here </head>" tags put this code: this will send email, by passing values thru IMG source.

<script language="Javascript">

function confirm_(frm){

document.images["init"].src="confirm.asp?firstname="+escape(frm.firstname.value)+"&lastname="+escape(frm.lastname.value)+"&company="+escape(frm.company.value)+"&phone="+escape(frm.phone.value)+"&email="+escape(frm.email.value)+"&rand="+(Math.random()*999);

}

</script>

3)  again in -contact_us.asp- inside the form add  "onsubmit=confirm_(this)".  (event to be invoked when form submits).

4)  now in between "<form onsubmit=confirm_(this)    .....>  right here </form>" add this:   <img src="blank.gif?" style="position:absolute;display:hidden" name="init">

that should do it. remmember do not remove "Math.random()*999" or you won't be able to accomplish all this.


cheers!
 dave
0
 
LVL 13

Expert Comment

by:davidlars99
ID: 11817096
sorry, not  this <img src="blank.gif?" style="position:absolute;display:hidden" name="init">
put this <img src="blank.gif?" style="position:absolute;visibility:hidden" name="init">

0
 
LVL 6

Author Comment

by:LunaSkye
ID: 11821323
ok,
Thank you David Lars, I will try your suggestion either today or tomorrow, im really swamped at the moment.

Webwoman. Thank you for the dose of sanity. Im glad im not the only one who distrusts FP.
If all else fails, i will tell her to just live with it the way it is, unless she wants me to redo everything.
I dont know why the heck she used FP.. uggh..  <headache>

-Andrew
0
 
LVL 11

Assisted Solution

by:sciber_dude
sciber_dude earned 200 total points
ID: 11821834
@ LunaSkye  -

I have a solution for you!

1. Go to this link  http://www33.brinkster.com/sbpress/Genasp.asp
2. Type the URL of your form in the textbox.
3. Click on Grab Page button
4. Select your primary Key Id, change the Database Variable Type to reflect those in your database
5. Make sure you check the "send email" checkbox

6.Scroll down to the bottom and click on "Submit" button.

On the next page, copy the code and paste it as your database writing script. You will need to make a few changes to the ASP code.

Change the form action on your form to send information to this new script you have saved.

Now, this cuts down ur code-writing time does n't it? If you like this solution, write some feedback here..
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20932343.html

:) SD



0
 
LVL 11

Expert Comment

by:sciber_dude
ID: 11895315
@ LunaSkye - Any feedback?
:) SD
0
 
LVL 6

Author Comment

by:LunaSkye
ID: 12483916
Thank you all so much for your help.
I never ended up finishing this off..

Sorry about the delay getting back.. very busy
-Andrew
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now