• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 858
  • Last Modified:

Retrieve Form Values From A Web Bot

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")


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.

  • 6
  • 4
  • 3
  • +1
3 Solutions
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.
LunaSkyeAuthor Commented:
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.

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!

ps.. happy monday
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.

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

LunaSkyeAuthor Commented:
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

<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:
It is in THIS page that i am sending out my email..


SUB sendmail( fromWho, toWho, Subject, Body )
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
End With

Set objCDO.Configuration = iConf

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



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

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>
          <!--webbot bot="ConfirmationField" S-Field="Title1" startspan --><%FP_ConfirmField("Title1")%><!--webbot bot="ConfirmationField" i-checksum="14563" endspan --><br>
          <!--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?
LunaSkyeAuthor Commented:
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 ?
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. ;-)
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.
LunaSkyeAuthor Commented:
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?
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.
>>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.
try to replace following code:

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


<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...

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){




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.

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">

LunaSkyeAuthor Commented:
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>

@ 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..

:) SD

@ LunaSkye - Any feedback?
:) SD
LunaSkyeAuthor Commented:
Thank you all so much for your help.
I never ended up finishing this off..

Sorry about the delay getting back.. very busy
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 6
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now