Forums

This topic is locked

Dreamweaver Print and Submit Form "Codes"

Posted 09 Jul 2003 16:50:01
1
has voted
09 Jul 2003 16:50:01 alan maiki posted:
hello guys, I am a newbee in DreamW and I am trying to 2 2 things: one is I wanna set my "SUBMIT" bottom so that when somebody clicks it will automatically send the whole page to my email or any email i choose. the second thing is I need to make a "PRINT" bottom so that when you will it will print the whole HTML page with whatever info they imput in the fields.....if anybody know how to do it I would appreciate alot....thanks....

Replies

Replied 09 Jul 2003 17:02:51
09 Jul 2003 17:02:51 Lee Diggins replied:
Hi Alan

What web server are you using?

Do you host your web site or does your ISP host it for you?

This below will open the print dialogue box:

<input name="Button" type="button" id="Button" value="Print" onClick="javascript:window.print();">

Digga

Sharing Knowledge Saves Valuable Time!!!
Replied 09 Jul 2003 17:17:36
09 Jul 2003 17:17:36 alan maiki replied:
Thanks DIGGA!!!
that was great...I am basically doin an internship "networking but part of my job is to help improve our Website so I am force to learn coding and making web with Dreamweaver.....the print code worked perfectly....thanks again....we are using a host web server....and dreamweaver and frontpage.......there are many things i need to learn..simple tasks but i am going one at a time......Do you know how to do the SUBMIT code so that the page is submitted automatically to an email address????
Hi Alan

What web server are you using?

Do you host your web site or does your ISP host it for you?

This below will open the print dialogue box:

<input name="Button" type="button" id="Button" value="Print" onClick="javascript:window.print();">

Digga

Sharing Knowledge Saves Valuable Time!!!
Replied 09 Jul 2003 17:20:21
09 Jul 2003 17:20:21 Lee Diggins replied:
Hi Alan

What web server are you using, IIS, Apache, Coldfusion etc.?

Digga

Sharing Knowledge Saves Valuable Time!!!
Replied 09 Jul 2003 17:30:01
09 Jul 2003 17:30:01 alan maiki replied:
Hey Digga...

They use NT server so I guess is IIS
I called then but couldnt reach em.....IIS I think! thanks for your help again!!!
Replied 09 Jul 2003 17:35:26
09 Jul 2003 17:35:26 Lee Diggins replied:
Hi Alan

You have to build a processing page, can you post the entire form page code and I'll show you how you do it?

I'm going home now, but I'll be back on in about 3 hours.

Have you done any of this type of thing before?

Check the ISP has CDONTS installed.

Digga

Sharing Knowledge Saves Valuable Time!!!
Replied 09 Jul 2003 17:53:54
09 Jul 2003 17:53:54 alan maiki replied:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>www.unanca.org</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href=" ">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="">
<p><font size="-1">NAME: (Mr./Ms./Mrs.)
<input type="text" name="textfield">
</font></p>
</form>
<form name="form2" method="post" action="">
<font size="-1"> SPOUSE (if applying for family membership):
<input type="text" name="textfield2">
</font>
</form>
<form name="form3" method="post" action="">
<font size="-1"> ORGANIZATION:
<input type="text" name="textfield3">
</font>
</form>
<form name="form4" method="post" action="">
<font size="-1"> ADDRESS:
<input type="text" name="textfield4">
</font>
</form>
<form name="form5" method="post" action="">
<font size="-1"> CITY/STATE/ZIP:
<input type="text" name="textfield5">
</font>
</form>
<form name="form6" method="post" action="">
<font size="-1"> EMAIL ADDRESS:
<input type="text" name="textfield6">
</font>
</form>
<form name="form7" method="post" action="">
<p><font size="-1"> HOME:
<input type="text" name="textfield7">
</font></p>
</form>
<form name="form8" method="post" action="">
</form>
<form name="form9" method="post" action="">
<font size="-1"> BUSINESS:
<input type="text" name="textfield8">
</font>
</form>
<form name="form10" method="post" action="">
<font size="-1"> MEMBERSHIP TYPE (CHECK ONE):
<input type="radio" name="radiobutton" value="radiobutton">
Personal
<input type="radio" name="radiobutton" value="radiobutton">
Family
<input type="radio" name="radiobutton" value="radiobutton">
Institution/Business </font>
</form>
<form name="form11" method="post" action="">
<font size="-1"> MEMBERSHIP STATUS (CHECK ONE):
<input type="radio" name="radiobutton" value="radiobutton">
New
<input type="radio" name="radiobutton" value="radiobutton">
Renewal </font>
</form>
<form name="form12" method="post" action="">
<font size="-1"> MEMBERSHIP DUES CATEGORY (CHECK ONE): </font>
</form>
<form name="form13" method="post" action="">
<p>
<label>
<input type="radio" name="RadioGroup1" value="radio">
</label>
<font size="-1">$10 Student (Introductory and Renewal) </font><br>
<label>
<input type="radio" name="RadioGroup1" value="radio">
</label>
<font size="-1"> $25 Introductory Individual or Fixed Income Renewal </font><br>
<label>
<input type="radio" name="RadioGroup1" value="radio">
</label>
<font size="-1"> $40 Renewal Individual or Family or Organization </font><br>
<label>
<input type="radio" name="RadioGroup1" value="radio">
</label>
<font size="-1">$100 Sponsor</font>
<label></label>
<br>
<label>
<input type="radio" name="radiogroup1" value="radiobutton">
</label>
<font size="-1">$500 Patron</font><br>
<label> </label>
<label>
<input type="radio" name="RadioGroup1" value="radio">
</label>
<font size="-1">$1,000 Lifetime Member </font><br>
<label></label>
</p>
</form>
<form name="form15" method="post" action="">
<font size="-1"> Please indicate which Committees, Task Forces or issues you
are interested in: </font>
</form>
<form name="form19" method="post" action="">
<font size="-1">
<input type="radio" name="radiobutton" value="radiobutton">
Adopt-A-Minefield
<input type="radio" name="radiobutton" value="radiobutton">
Advocacy
<input type="radio" name="radiobutton" value="radiobutton">
Africa
<input type="radio" name="radiobutton" value="radiobutton">
Asia </font>
</form>
<form name="form20" method="post" action="">
<font size="-1">
<input type="radio" name="radiobutton" value="radiobutton">
Communications
<input type="radio" name="radiobutton" value="radiobutton">
Cultures of Peace
<input type="radio" name="radiobutton" value="radiobutton">
DC Justice </font>
</form>
<form name="form21" method="post" action="">
<font size="-1">
<input type="radio" name="radiobutton" value="radiobutton">
Education
<input type="radio" name="radiobutton" value="radiobutton">
Fundraising
<input type="radio" name="radiobutton" value="radiobutton">
Human Rights
<input type="radio" name="radiobutton" value="radiobutton">
International Law </font>
</form>
<form name="form22" method="post" action="">
<font size="-1">
<input type="radio" name="radiobutton" value="radiobutton">
Latin America
<input type="radio" name="radiobutton" value="radiobutton">
Membership
<input type="radio" name="radiobutton" value="radiobutton">
Media </font>
</form>
<form name="form23" method="post" action="">
<p> <font size="-1">
<input type="radio" name="radiobutton" value="radiobutton">
Peace and Security
<input type="radio" name="radiobutton" value="radiobutton">
Sustainable Development
<input type="radio" name="radiobutton" value="radiobutton">
Young Professionals</font></p>
</form>
<form name="form24" method="post" action="">
<p><font size="-1">In addition to my dues, I would like to make a special contribution
to: </font></p>
</form>
<form name="form25" method="post" action="">
<font size="-1">
<input type="radio" name="radiobutton" value="radiobutton">
UNA-USA National Programs in the amount of $
<input type="text" name="textfield9">
</font>
</form>
<form name="form26" method="post" action="">
<font size="-1">
<input name="radiobutton" type="radio" value="radiobutton">
My local chapter in the amount of $
<input type="text" name="textfield10">
</font>
</form>
<form name="form27" method="post" action="">
<font size="-1"> (Contributions are tax deductible to the extent provided by
law.) </font>
</form>
<form name="form28" method="post" action="">
<p align="center"> <font size="-1">
<label> </label>
<input name="Button" type="button" id="Button" value="Print" onClick="javascript:window.print();">
<label> </label>
<label> </label>
</font></p>
</form>
<form action="" method="post" name="form29" target="_blank">
<p> <font size="-1">
<label> </label>
</font></p>
<p align="center"> <font size="-1">
<label></label>
UNA-NCA Membership Services<br>
1808 Connecticut Avenue, NW Suite 101 Washington, DC 20009 </font></p>
</form>
<p align="center"><font size="-1">Questions? Call us at (202) 518-0471 </font></p>
<p> <font size="-1"><br>
</font> </p>
</body>
</html>
Replied 09 Jul 2003 17:57:29
09 Jul 2003 17:57:29 alan maiki replied:
HEy man...I dont know much about this... I am basically learning....but i uploaded the code of the form "I think that's what you wanted"....I 'll be around checking the posted messages for any reply.....thanks.....

You have to build a processing page, can you post the entire form page code and I'll show you how you do it?

I'm going home now, but I'll be back on in about 3 hours.

Have you done any of this type of thing before?

Check the ISP has CDONTS installed.

Digga

Sharing Knowledge Saves Valuable Time!!!
Replied 10 Jul 2003 13:52:11
10 Jul 2003 13:52:11 Lee Diggins replied:
Hi Alan

Here are the two pages:

Form.asp

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>www.unanca.org</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href=" ">
</head>
<body>
<form action="processing.asp" method="post" name="frmDetails" id="frmDetails">
<p>NAME: (Mr./Ms./Mrs.)
<input type="text" name="txtName">
</p>
<p>SPOUSE (if applying for family membership):
<input type="text" name="txtSpouse">
</p>
<p>ORGANIZATION:
<input type="text" name="txtOrganization">
</p>
<p>ADDRESS:
<input type="text" name="txtAddress">
</p>
<p>CITY/STATE/ZIP:
<input type="text" name="txtCity">
</p>
<p>EMAIL ADDRESS:
<input type="text" name="txtEmail">
</p>
<p>HOME:
<input type="text" name="txtHome">
</p>
<p>BUSINESS:
<input type="text" name="txtBusiness">
</p>
<p>MEMBERSHIP TYPE (CHECK ONE): </p>
<p>
<input type="radio" name="radType" value="Personal">
Personal
<input type="radio" name="radType" value="Family">
Family
<input type="radio" name="radType" value="Institution/Business">
Institution/Business </p>
<p>MEMBERSHIP STATUS (CHECK ONE): </p>
<p>
<input type="radio" name="radStatus" value="New">
New
<input type="radio" name="radStatus" value="Renewal">
Renewal </p>
<p>MEMBERSHIP DUES CATEGORY (CHECK ONE): </p>
<p>
<input type="radio" name="radCategory" value="$10 Student (Introductory and Renewal)">
$10 Student (Introductory and Renewal)<br>
<input type="radio" name="radCategory" value="$25 Introductory Individual or Fixed Income Renewal">
$25 Introductory Individual or Fixed Income Renewal<br>
<input type="radio" name="radCategory" value="$40 Renewal Individual or Family or Organization">
$40 Renewal Individual or Family or Organization<br>
<input type="radio" name="radCategory" value="$100 Sponsor">
$100 Sponsor<br>
<input type="radio" name="radCategory" value="$500 Patron">
$500 Patron<br>
<input type="radio" name="radCategory" value="$1,000 Lifetime Member">
$1,000 Lifetime Member</p>
<p>Please indicate which Committees, Task Forces or issues you are interested
in:</p>
<p>
<input type="radio" name="radCommittee" value="Adopt-A-Minefield">
Adopt-A-Minefield
<br>
<input type="radio" name="radCommittee" value="Advocacy">
Advocacy
<br>
<input type="radio" name="radCommittee" value="Africa">
Africa
<br>
<input type="radio" name="radCommittee" value="Asia">
Asia
<br>
<input type="radio" name="radCommittee" value="Communications">
Communications
<br>
<input type="radio" name="radCommittee" value="Cultures of Peace">
Cultures of Peace
<br>
<input type="radio" name="radCommittee" value="DC Justice">
DC Justice
<br>
<input type="radio" name="radCommittee" value="Education">
Education
<br>
<input type="radio" name="radCommittee" value="Fundraising">
Fundraising
<br>
<input type="radio" name="radCommittee" value="Human Rights">
Human Rights
<br>
<input type="radio" name="radCommittee" value="International Law">
International Law
<br>
<input type="radio" name="radCommittee" value="Latin America">
Latin America
<br>
<input type="radio" name="radCommittee" value="Membership">
Membership
<br>
<input type="radio" name="radCommittee" value="Membership">
Media
<br>
<input type="radio" name="radCommittee" value="Peace and Security">
Peace and Security
<br>
<input type="radio" name="radCommittee" value="Sustainable Development">
Sustainable Development
<br>
<input type="radio" name="radCommittee" value="Young Professionals">
Young Professionals</p>
<p>In addition to my dues, I would like to make a special contribution to:</p>
<p>
UNA-USA National Programs in the amount of $
<input type="text" name="txtNational">
</p>
<p>
My local chapter in the amount of $
<input type="text" name="txtLocal">
</p>
<p>(Contributions are tax deductible to the extent provided by law.)</p>
<p>
<input type="submit" name="Submit" value="Submit">
<input name="Reset" type="reset" id="Reset" value="Reset">
</p>
</form>
<p align="center">UNA-NCA Membership Services<br>
1808 Connecticut Avenue, NW Suite 101 Washington, DC 20009 </p>
<p align="center">Questions? Call us at (202) 518-0471</p>
</body>
</html>

Processing.asp

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim strBody
'For Each Item In Request.Form
'fieldName = Replace(Item,"txt",""
'fieldName = Replace(fieldName,"rad",""
'fieldName = Replace(fieldName,"Submit",""
'fieldValue = Replace(Request.Form(Item),"Submit",""
' strBody = strBody & fieldName & ": " & fieldValue & vbcrlf
'Next

strBody = strBody & "Name: " & Request.Form("txtName" & vbcrlf
strBody = strBody & "Spouse: " & Request.Form("txtSpouse" & vbcrlf
strBody = strBody & "Organization: " & Request.Form("txtOrganization" & vbcrlf
strBody = strBody & "Address: " & Request.Form("txtAddress" & vbcrlf
strBody = strBody & "City: " & Request.Form("txtCity" & vbcrlf
strBody = strBody & "Email: " & Request.Form("txtEmail" & vbcrlf
strBody = strBody & "Home: " & Request.Form("txtHome" & vbcrlf
strBody = strBody & "Business: " & Request.Form("txtBusiness" & vbcrlf
strBody = strBody & "Type: " & Request.Form("radType" & vbcrlf
strBody = strBody & "Status: " & Request.Form("radStatus" & vbcrlf
strBody = strBody & "Category: " & Request.Form("radCategory" & vbcrlf
strBody = strBody & "Committee: " & Request.Form("radCommittee" & vbcrlf
strBody = strBody & "National: " & Request.Form("txtNational" & vbcrlf
strBody = strBody & "Local: " & Request.Form("txtLocal" & vbcrlf

Dim attFile
'attFile = 'set the path to a file to attach to the e-mail

Dim objNewMail

Set objNewMail = Server.CreateObject("CDONTS.NewMail"

objNewMail.To = " "
'objNewMail.CC = " "
'objNewMail.BCC = " "
objNewMail.From = " "
'objNewMail.Value("Reply-To" = " "
objNewMail.Subject = "My Form Details"
objNewMail.Body = strBody
objNewMail.BodyFormat = 1 '1 = text, 2 = html
objNewMail.MailFormat = 1 '1 = text, 2 = MIME
objNewMail.Importance = 1 '1, 2 or 3
'objNewMail.AttachFile attFile 'see above
objNewMail.Send

set objNewMail = Nothing 'destroy object
%>

<html>
<head>
<title>Processing Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>
The following have been emailed:
</p>
<p>
<%= Replace(strBody,vbcrlf,"<br>"%></p>
<p>
<input name="Button" type="button" id="Button" value="Print" onClick="javascript:window.print();">
</p>
</body>
</html>


Digga

Sharing Knowledge Saves Valuable Time!!!

Edited by - Digga the Wolf on 10 Jul 2003 13:57:20
Replied 10 Jul 2003 15:12:07
10 Jul 2003 15:12:07 alan maiki replied:
Hey Digga!! Thanks for the code.....Look I am sure something I am doin wrong cuz I am trying to test the submit but it doesn't work.....I guess my email needs to be configure on the asp code....Could you explain me what I am missing to do....Once again, I am a newbee and kinda clueless and still learning!!!! I notice the email part of the coding which was different from what i sent you so.......Any thoughts?
Replied 10 Jul 2003 16:01:39
10 Jul 2003 16:01:39 Lee Diggins replied:
Hi Alan

On the processing page change this:

objNewMail.To = " "

contain your e-mail address.

Make sure you use both of my pages as yours was a bit iffy.

Digga

Sharing Knowledge Saves Valuable Time!!!
Replied 10 Jul 2003 16:59:13
10 Jul 2003 16:59:13 alan maiki replied:
Thanks Digga....I open both pages in Dreamweaver......when I try to preview browser it tells me "To Preview Pages containing server-side-code you need a testing server. Would you like to specify one now?" ..Is that a must in order to the the form submittion work...? what does it mean exactly....?
Replied 10 Jul 2003 23:47:57
10 Jul 2003 23:47:57 Lee Diggins replied:
Hi Alan

What does it mean? It means you need to set up your site in DW, read the help file and/or do a search of this site for a tutorial.

No you don't need to set your site up for the pages to work. Just save them together in a folder in your web site and call the pages from your browser.

You need to learn how to construct a form, what it can do and about the objects you can use in the form. How to capture the data being sent by the form and use it.

You say you're being forced into learning code, do you want to or do you just want the solution?

Read this, it explains the NewMail object and your options:
'-----------------------------------------------------------------
'The code below contains comments.
'The apostrophe (') denotes the comment.
'Remove the (') to use the code.
'-----------------------------------------------------------------
'declare the variable for the new mail message object
Dim objNewMail

'assign the new mail message object to the variable declared above
Set objNewMail = Server.CreateObject("CDONTS.NewMail"

objNewMail.To = " " 'this is the TO email field - compulsory
'objNewMail.CC = " " 'this is the CC email field
'objNewMail.BCC = " " 'this is the BCC email field
objNewMail.From = " " 'this is the FROM email field - compulsory
'this is the REPLY-TO email field
''objNewMail.Value("Reply-To" = " "
objNewMail.Subject = "My Form Details" 'this is the SUBJECT field
' this is the BODY of the mail message created above
'using Request.Form and assigned to the strBody variable
objNewMail.Body = strBody
objNewMail.BodyFormat = 1 '1 = text, 2 = html
objNewMail.MailFormat = 1 '1 = text, 2 = MIME
objNewMail.Importance = 1 '1, 2 or 3
'objNewMail.AttachFile attFile 'see above
objNewMail.Send 'send the email

set objNewMail = Nothing 'destroy the object created above

'-----------------------------------------------------------------
'End
'-----------------------------------------------------------------

Let me know if you have any more questions, but try yourself first.

Digga

Sharing Knowledge Saves Valuable Time!!!

Edited by - Digga the Wolf on 10 Jul 2003 23:49:42
Replied 11 Jul 2003 15:37:54
11 Jul 2003 15:37:54 alan maiki replied:
Digga thanks alot.....you really got me started and now i will figure the rest out since i must learn it anyway....I like making webs, so I will learning anyway...it is just that the short period of time for my intership makes it challenging......thanks again...and I am sure soon I 'll have a new question....<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> take care.....

Alain Maiki
Replied 18 Jul 2003 19:24:52
18 Jul 2003 19:24:52 alan maiki replied:
Hey DIGGA...I need your help......I uploaded your form and man I am frustrated cuz i cant make it work...i tried different ways.....I saved the 2 pages as different files as you said......basically html files.....i also try saving them as asp files......neither worked online when i clicked SUBMIT....it when to a page saying cannot find server or url.....you know that IE page when not online.....basically i dont know what i am doing wrong.......i copied exactly the 2 codes you gave me and pasted them on 2 dreamweaver's page and they looked perfect and everything ....i put both files online in the same subfolder and the links are perfect and everything....I just dont understand why there has to be a second page ....I am confused.......Help <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>!!!!

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hi Alan

What does it mean? It means you need to set up your site in DW, read the help file and/or do a search of this site for a tutorial.

No you don't need to set your site up for the pages to work. Just save them together in a folder in your web site and call the pages from your browser.

You need to learn how to construct a form, what it can do and about the objects you can use in the form. How to capture the data being sent by the form and use it.

You say you're being forced into learning code, do you want to or do you just want the solution?

Read this, it explains the NewMail object and your options:
'-----------------------------------------------------------------
'The code below contains comments.
'The apostrophe (') denotes the comment.
'Remove the (') to use the code.
'-----------------------------------------------------------------
'declare the variable for the new mail message object
Dim objNewMail

'assign the new mail message object to the variable declared above
Set objNewMail = Server.CreateObject("CDONTS.NewMail"

objNewMail.To = " " 'this is the TO email field - compulsory
'objNewMail.CC = " " 'this is the CC email field
'objNewMail.BCC = " " 'this is the BCC email field
objNewMail.From = " " 'this is the FROM email field - compulsory
'this is the REPLY-TO email field
''objNewMail.Value("Reply-To" = " "
objNewMail.Subject = "My Form Details" 'this is the SUBJECT field
' this is the BODY of the mail message created above
'using Request.Form and assigned to the strBody variable
objNewMail.Body = strBody
objNewMail.BodyFormat = 1 '1 = text, 2 = html
objNewMail.MailFormat = 1 '1 = text, 2 = MIME
objNewMail.Importance = 1 '1, 2 or 3
'objNewMail.AttachFile attFile 'see above
objNewMail.Send 'send the email

set objNewMail = Nothing 'destroy the object created above

'-----------------------------------------------------------------
'End
'-----------------------------------------------------------------

Let me know if you have any more questions, but try yourself first.

Digga

Sharing Knowledge Saves Valuable Time!!!

Edited by - Digga the Wolf on 10 Jul 2003 23:49:42
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Replied 19 Jul 2003 00:12:54
19 Jul 2003 00:12:54 Lee Diggins replied:
Hi Alan

Contact your ISP and ask if he has cdonts installed. If not, ask him why, then what mail component he has installed that you can use.

Both of the pages need to be ASP pages, ok?

Mail me at if you need to.

Digga

Sharing Knowledge Saves Valuable Time!!!
Replied 22 Jul 2003 22:56:21
22 Jul 2003 22:56:21 Lee Diggins replied:
Hi Alan

Made a bit of goof change this...

objNewMail.BodyFormat = 1 '1 = text, 2 = html
objNewMail.MailFormat = 1 '1 = text, 2 = MIME
objNewMail.Importance = 1 '1, 2 or 3

...to this

objNewMail.BodyFormat = 1 '1 = text, 0 = html
objNewMail.MailFormat = 1 '1 = text, 0 = MIME
objNewMail.Importance = 1 '0 - low, 1 - medium or 2 - high

Digga

Sharing Knowledge Saves Valuable Time!!!

Reply to this topic