Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Word web form scripting?

Status
Not open for further replies.

dprayner

Programmer
Oct 14, 2002
140
US
Hi people.

I was wondering how to create a simple web form in MS Word 2003.

So far I have created a new Document as web page and have added several controls including a drop-down combo box, text box, and submit button.

I want to have the user be able to fill out the form, and when the click on the submit button, email it to a certain email address (ie. someone@somewhere.com) and have the form in the body of the email with the data intact.

I noticed each of the controls has its own properties and I think I have figured out the property for the combo box, but I'm not sure how to set up the submit button.

I noticed that there is a MS Script editor, but I am not really familiar with scripting or html code.

Any suggestions? DAVE
 
dprayner,
I don't know how to insert a form into a document using Word as an HTML editor, but here is a sample of the underlying HTML code with the information you requested in bold.
Once you have the page created you can swith to the HTML Source (View=>HTML Source) and add the appropriate code.

Code:
[navy]<FORM method="post" [b]action="mailto:YourName@YourCompany.com?subject=Your Inbound Subject here" enctype="text/plain"[/b]>[/navy]
  <INPUT TYPE="hidden" NAME="internalsubject" VALUE="hidden submit"><P>

  Question 1:<P>
  <INPUT TYPE=Radio Name=Question1 Value=1>One
  <INPUT TYPE=Radio Name=Question1 Value=2>Two
  <INPUT TYPE=Radio Name=Question1 Value=3>Three
  <INPUT TYPE=Radio Name=Question1 Value=4>Four
  <INPUT TYPE=Radio Name=Question1 Value=5>Five<P>

  Question 2:<P>
  <INPUT TYPE=Radio Name=Question2 Value=1>One
  <INPUT TYPE=Radio Name=Question2 Value=2>Two
  <INPUT TYPE=Radio Name=Question2 Value=3>Three
  <INPUT TYPE=Radio Name=Question2 Value=4>Four
  <INPUT TYPE=Radio Name=Question2 Value=5>Five<P>

  (rest of form content)<P>
  [b]<INPUT Type=Submit VALUE=Respond>[/b]

[navy]</FORM>[/navy]

NOTE: This will not email the entire document, just the field names and values (i.e. [tt]internalsubject="hidden submit",Question1=2,Question2=2[/tt]), if you need the entire text you will need to write a script.

Hope this helps,
CMP

(GMT-07:00) Mountain Time (US & Canada)
 
dprayner, it sounds like I want to do the same thing as you're trying to do. I want to create a web form with Word that can be filled out on-line, and then submitted as an e-mail attachment, or in the body. But, I am having trouble with the submit button. When I click on submit, a blank e-mail is created, with the correct address ready to send.

I am not fluent in VBA, and was wondering if you got this to work, would you mind forwarding the details?

Thanks for any help!
Dan
 
I created a simple form in word. In order to get anything emailed to me I ahd to add the submit button and then make two changes in the submit control properties

action: mailto:youradress@wherever.com
encoding: text/plain (this send the data as plain text)
method: post

hope this helps
 
Hi imateacher.

I altered my properties of the submit button and when I exited design mode, I clicked on the submit button and an email message with the mailto address popup, but did not send. Also the submit button and several text boxes were not in the body of the email.
 
Thanks for the response!

Well... it kind of helps. Before, my Outlook client opened up a page for me to click send on. Now, I just get the notification that my client is going to send an e-mail.

I can live with that. Here are my setting now:

(Name): HTMLSubmit1
Action: "mailto:test@test.com"
Caption: Submit Form
Encoding: text/plain
Height: 22.5
HTMLName: Remember_when_our_grandparents6.htm
Method: Post
Width: 57

This comes accross in the subject line:
Form posted from Microsoft Internet Explorer.

This comes across in the body:
Remember_when_our_grandparents6.htm=Submit Form

Still no form, or data from the form.

Again, any help is greatly appreciated!
Dan
 
I know this is probably a stupid question but are you clicking submit in webpage preview (file, web page preview) or are you clicking in the word document environment?
 
try going to file, web page preview and then click submit and see what happens.
 
Hi all. I was able to send the form in web page preview. The Subject line says Form posted from Microsoft Internet Explorer and the only thing that comes in the body is test.htm = Submit.

How does one get the body to come through. I don't have much experience with script writing. DAVE
 
Imateacher, I answered incorrectly before. I have tried this every way, including published on my Intranet. I get the same results as dprayner.

I'll review your working form as soon as I can (I'm kept busy here).

Thanks again.
Wigertd
 
Dprayner - I know this is probably a stupid question but did you set the HTMLName property for each of your input fields in the properties box. This is what lets it send the response.
 
Hi imatracher.

I did set the names for example a combo box I put combo. Wheh I Submit it, I get combo = A in the body of the email. I am not getting the objects. DAVE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top