|
 |
asp_web_howto thread: Help with a Form!
Message #1 by "Emily Uyeda" <e-uyeda@h...> on Mon, 16 Apr 2001 11:06:45 -0700
|
|
I have a form with a submit button on it. I want the the user to complete
all of the entries within the form. If their entries are complete and they
click on the submit button, I want a confirmation page to pop up with a
message that says "Thank you, [First Name from txtFirstName field]" and the
results to get stored in a text file. I have no idea how to code all of
this. I have made up my form using notepad because I hate front page. can
someone PLEASE help me with this matter?
If the form is not complete, I will use vbscript to deal with this error. I
can manage this part though. It's the Confirmation page that I am having
difficulty with.
Also, my second question is: I am using notepad to create all of my web
pages because I read that you'd have more control over the way your web page
looks if you use Notepad. I hate using Frontpage because of all the extra
code it generates. Is notepad the best way to code the web pages? or
should I use Frontpage? My web site is getting bigger and bigger and
sometimes notepad can be a bit archaic. Someone suggested to me that I use
Interdev... but is that any different from Front Page? am I approaching
the coding of my web site correctly by using notepad?
Thanks,
Emily
Message #2 by "O'Hara, Elliott M" <EMOHARA@k...> on Mon, 16 Apr 2001 14:59:13 -0400
|
|
Interdev is excellent... It has autocomplete features that make life mush
simpler for the asp programmer. I highly recommend it.
I'm not sure exactly what your problem is whit the submit button... if you
post some code we might be able to help you better...
Heres a shot in the dark at what you want... If it doesn't help respond with
some code..
<form id="blah" language="javascript" onsubmit="CheckMe()">
all youre form stuff in here....
</form>
then use this function
<script language="javascript">
// put all you error checking here
alert("Thank You " + blah.txtFirstName.value)
</script>
-----Original Message-----
From: Emily Uyeda [mailto:e-uyeda@h...]
Sent: Monday, April 16, 2001 2:44 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Help with a Form!
I have a form with a submit button on it. I want the the user to complete
all of the entries within the form. If their entries are complete and they
click on the submit button, I want a confirmation page to pop up with a
message that says "Thank you, [First Name from txtFirstName field]" and the
results to get stored in a text file. I have no idea how to code all of
this. I have made up my form using notepad because I hate front page. can
someone PLEASE help me with this matter?
If the form is not complete, I will use vbscript to deal with this error. I
can manage this part though. It's the Confirmation page that I am having
difficulty with.
Also, my second question is: I am using notepad to create all of my web
pages because I read that you'd have more control over the way your web page
looks if you use Notepad. I hate using Frontpage because of all the extra
code it generates. Is notepad the best way to code the web pages? or
should I use Frontpage? My web site is getting bigger and bigger and
sometimes notepad can be a bit archaic. Someone suggested to me that I use
Interdev... but is that any different from Front Page? am I approaching
the coding of my web site correctly by using notepad?
Thanks,
Emily
Message #3 by "Daniel O'Dorisio" <dodorisio@h...> on Mon, 16 Apr 2001 14:42:27 -0400
|
|
on the confirmation page do something like:
Response.Write "Thank you, " & Request.Form("txtfirstname")
that will write out
Thank you, Name
about fp interdev and notepad.
i hate fp... with a passion allmost:-) it screws my asp code. i use
interdev, but only the editing part of it, no dtc's no WYSIWYG html. just
the straight up editor. only because of the color coding. and inline auto
complete. and also a friend bought it for me:-) but i really think it is
just a personal preference.
Daniel
-----Original Message-----
From: Emily Uyeda [mailto:e-uyeda@h...]
Sent: Monday, April 16, 2001 2:44 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Help with a Form!
I have a form with a submit button on it. I want the the user to complete
all of the entries within the form. If their entries are complete and they
click on the submit button, I want a confirmation page to pop up with a
message that says "Thank you, [First Name from txtFirstName field]" and the
results to get stored in a text file. I have no idea how to code all of
this. I have made up my form using notepad because I hate front page. can
someone PLEASE help me with this matter?
If the form is not complete, I will use vbscript to deal with this error. I
can manage this part though. It's the Confirmation page that I am having
difficulty with.
Also, my second question is: I am using notepad to create all of my web
pages because I read that you'd have more control over the way your web page
looks if you use Notepad. I hate using Frontpage because of all the extra
code it generates. Is notepad the best way to code the web pages? or
should I use Frontpage? My web site is getting bigger and bigger and
sometimes notepad can be a bit archaic. Someone suggested to me that I use
Interdev... but is that any different from Front Page? am I approaching
the coding of my web site correctly by using notepad?
Thanks,
Emily
Message #4 by "Brian" <bgmst5@y...> on Mon, 16 Apr 2001 20:21:41
|
|
Hi,
Use the action property of the form to post the data to the confirmation
page. From there, then use Request.form to grab all those value and write
out the message you want to display. Check out the wrox books if you have
no idea how to do this.
Just remember that if you use VBScript it only works in Internet Explorer.
Interdev is so much better than Notepad for several reasons (Home Site and
ColdFusion by Allaire are other products similar to Interdev). Notepad is
a simple text editor, whereas Interdev recognizes key words (if, else,
set, etc.). Interdev also comes with MSDN, which is a tremendous help if
you have questions. Frontpage just lets you develop a simple web page
easier.
Brian
> I have a form with a submit button on it. I want the the user to
complete
> all of the entries within the form. If their entries are complete and
they
> click on the submit button, I want a confirmation page to pop up with a
> message that says "Thank you, [First Name from txtFirstName field]" and
the
> results to get stored in a text file. I have no idea how to code all of
> this. I have made up my form using notepad because I hate front page.
can
> someone PLEASE help me with this matter?
>
> If the form is not complete, I will use vbscript to deal with this
error. I
> can manage this part though. It's the Confirmation page that I am having
> difficulty with.
>
> Also, my second question is: I am using notepad to create all of my web
> pages because I read that you'd have more control over the way your web
page
> looks if you use Notepad. I hate using Frontpage because of all the
extra
> code it generates. Is notepad the best way to code the web pages? or
> should I use Frontpage? My web site is getting bigger and bigger and
> sometimes notepad can be a bit archaic. Someone suggested to me that I
use
> Interdev... but is that any different from Front Page? am I approaching
> the coding of my web site correctly by using notepad?
>
> Thanks,
> Emily
>
>
Message #5 by Scott Watermasysk <swatermasysk@C...> on Mon, 16 Apr 2001 15:21:10 -0400
|
|
Emily,
Here is some sample code: Please contact me at
swatermasysk@c... if you would like the actual files.
I doubt the listserver would allow attachments.
I encapsulated a sign up form in a procedure, because I needed to use it on
multiple pages.
To call the procedure I needed to include 1 file, and call the procedure.
<!--#INCLUDE File= "includes/SignUp.asp"-->
<%
Call SignUp ("Form Tilte", "ThisPageName") ' Please note you do not have to
include the .asp
%>
After you hit submit, it will recall this same page, but will run some
different code:
(it looks rather long, but that is because I hard coded all 50 us
states...just delete them if you do not need them.
Here is the Signup.asp code:
Start--SignUp.ASP ---
<!--#INCLUDE File="Connection.asp"-->
<!--#INCLUDE File="SignUpFormValidation.asp"-->
<%
Dim ConQS, ContactText, rq
ConQS = Request.Querystring("SignUp")
rq = "<Font Color = 'FF0000'> *</Font>"
Sub SignUp(sProject, sPage)
If ConQS = "" Then
ContactText = ContactText & "<table border = '0'>"
ContactText = ContactText & "<tr><td ColSpan = '2'><span
class='subtitle'>Please use this form to sign up for the " & sProject & "
Project</span></td></tr>"
ContactText = ContactText & "<td RowSpan = '10' width='40'><img
width='40' height-'1' border='0' src='images/clear.gif'></td>"
ContactText = ContactText & "<tr><td>"
ContactText = ContactText & "<form Action = '" & sPage &
".asp?SignUp=Submit' onsubmit='return Form1_Validator(this)' name='Form1'
Method = 'Post'>"
ContactText = ContactText & "<table border = '0'><tr>"
ContactText = ContactText & "<td>First Name</td><td><INPUT
TYPE='text' NAME='FName'></td></tr>"
ContactText = ContactText & "<tr><td>Last Name</td><td><INPUT
TYPE='text' NAME ='LNAME'></td></tr>"
ContactText = ContactText & "<tr><td>Street Address</td><td><INPUT
TYPE='text' NAME ='Address1'>" & rq & "</td></tr>"
ContactText = ContactText & "<tr><td></td><td><INPUT TYPE='text'
NAME ='Address2'></td></tr>"
ContactText = ContactText & "<tr><td>City</td><td><INPUT TYPE='text'
NAME ='City'>" & rq & "</td></tr>"
ContactText = ContactText & "<tr><td>State</td><td><SELECT
NAME='State' WIDTH=312><option selected>(Click here to
choose)</option><OPTION VALUE='AL'> Alabama<OPTION VALUE='AK'> Alaska<OPTION
VALUE='AZ'> Arizona<OPTION VALUE='AR'> Arkansas<OPTION VALUE='CA'>
California<OPTION VALUE='CO'> Colorado<OPTION VALUE='CT'> Connecticut<OPTION
VALUE='DE'> Delaware<OPTION VALUE='DC'> District of Columbia<OPTION
VALUE='FL'> Florida<OPTION VALUE='GA'> Georgia<OPTION VALUE='HI'>
Hawaii<OPTION VALUE='ID'> Idaho<OPTION VALUE='IL'> Illinois<OPTION
VALUE='IN'> Indiana<OPTION VALUE='IA'> Iowa<OPTION VALUE='KS'> Kansas<OPTION
VALUE='KY'> Kentucky<OPTION VALUE='LA'> Louisiana<OPTION VALUE='ME'>
Maine<OPTION VALUE='MD'> Maryland<OPTION VALUE='MA'> Massachusetts<OPTION
VALUE='MI'> Michigan<OPTION VALUE='MN'> Minnesota<OPTION VALUE='MS'>
Mississippi<OPTION VALUE='MO'> Missouri<OPTION VALUE='MT'> Montana<OPTION
VALUE='NE'> Nebraska<OPTION VALUE='NV'> Nevada<OPTION VALUE='NH'> New
Hampshire<OPTION VALUE='NJ'> New Jersey<OPTION VALUE='NM'> New Mexico<OPTION
VALUE='NY'> New York<OPTION VALUE='NC '> North Carolina<OPTION VALUE='ND'>
North Dakota<OPTION VALUE='OH'> Ohio<OPTION VALUE='OK'> Oklahoma<OPTION
VALUE='OR'> Oregon<OPTION VALUE='PA'> Pennsylvania<OPTION VALUE='RI'> Rhode
Island<OPTION VALUE='SC'> South Carolina<OPTION VALUE='SD'> South
Dakota<OPTION VALUE='TN'> Tennessee<OPTION VALUE='TX'> Texas<OPTION
VALUE='UT'> Utah<OPTION VALUE='VT'> Vermont<OPTION VALUE='VA'>
Virginia<OPTION VALUE='WA'> Washington<OPTION VALUE='WV'> West
Virginia<OPTION VALUE='WI'> Wisconsin<OPTION VALUE='WY'> Wyoming</Select>" &
rq & "</td></tr>"
ContactText = ContactText & "<tr><td>Zip Code</td><td><INPUT
TYPE='text' Size = '5' NAME ='ZipCode1'>"& rq & " - <INPUT TYPE='text' Size
= '4' NAME ='ZipCode2'></td></tr>"
ContactText = ContactText & "<tr><td>Phone Number</td><td><INPUT
TYPE='text' NAME ='Phone'></td></tr>"
ContactText = ContactText & "<tr><td>Email</td><td><INPUT
TYPE='text' NAME ='Email'></td></tr>"
ContactText = ContactText & "<tr>"
ContactText = ContactText & "<td ColSpan = '2'><INPUT TYPE='submit'
Value = 'Submit'></td></tr>"
ContactText = ContactText & "<td Align = 'Center' ColSpan
'2'><Font Color = 'FF0000'>* Items are required.</Font></td></tr>"
ContactText = ContactText & "</table></td></tr>"
ContactText = ContactText & "</Form>"
ContactText = ContactText & "</table>"
Else
Dim FName, LName, Study, Email, Address1, Address2, Phone,
ZipCode1, ZipCode2, sCookie, State, strSQL, City
FName = Trim(Request.Form("FName"))
LName = Trim(Request.Form("LName"))
Email = Trim(Request.Form("Email"))
Address1 = Trim(Request.Form("Address1"))
Address2 = Trim(Request.Form("Address2"))
State = Trim(Request.Form("State"))
City = Trim(Request.Form("City"))
Phone = Trim(Request.Form("Phone"))
ZipCode1 = Trim(Request.Form("ZipCode1"))
ZipCode2 = Trim(Request.Form("ZipCode2"))
'Update the database
strSQL = "Select * FROM SignUp"
OpenDB sConn 'Open the DB
rs.Open strSQL,,,adCmdTable
rs.AddNew
rs("FName") = FName
rs("LName") = LName
rs("Email") = Email
rs("Address1") = Address1
rs("Address2") = Address2
rs("State") = State
rs("City") = City
rs("ZipCode1") = ZipCode1
rs("ZipCode2") = ZipCode2
rs("Phone") = Phone
rs("Date") = Date
rs.Update
CloseDB 'Close and Destroy the connection
Response.Redirect "ThankYou.asp?FName=" & FName ' On the thank you
page use Response.QueryString("FName") to get the users first name.
End If
Out(ContactText)
End Sub
%>
Finish--SignUp.ASP ---
I also have a file to handle my ASP Connection:
Just edit the sDB field to the path of you db
Start -- Connection.asp --
<!-- METADATA TYPE="typelib"
FILE="C:\Program Files\Common Files\System\ado\msado15.dll"
-->
<%
Dim objConn, sConn, rs, sDB
sDB = "C:\Databases\DB.mdb"
'Construct the connection string
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Persist Security Info=False; Data Source=" & sDB
'Pre Create the connection and recordset objects
set objConn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
sub OpenDB(sConn)
objconn.open sConn
set rs.ActiveConnection = objConn
rs.CursorType = adOpenStatic
end sub
sub CloseDB()
rs.close
objconn.close
set rs = nothing
set objconn = nothing
end sub
--Finish -- Connection.ASP
And finally, here is some sample JavaScript to validate the form....again
delete what you do not need
--Start --
<script Language="JavaScript">
<!--
function Form1_Validator(theForm)
{
var alertsay = ""; // define for long lines
if (theForm.Address1.value == "")
{
alert("Please enter your street address.");
theForm.Address1.focus();
return (false);
}
if (theForm.City.value == "")
{
alert("Please enter your city.");
theForm.City.focus();
return (false);
}
// check if zip code field is blank
if (theForm.ZipCode1.value == "")
{
alert("Please enter your zip code.");
theForm.ZipCode1.focus();
return (false);
}
// check if no drop down has been selected
if (theForm.State.selectedIndex < 0)
{
alert("Please select a state.");
theForm.State.focus();
return (false);
}
// check if the first drop down is selected, if so, invalid selection
if (theForm.State.selectedIndex == 0)
{
alert("Please select a state.");
theForm.State.focus();
return (false);
}
return (true);
}
//--></script>
--Finish -- SignUpFormValidation.asp --
-----Original Message-----
From: Emily Uyeda [mailto:e-uyeda@h...]
Sent: Monday, April 16, 2001 2:44 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Help with a Form!
I have a form with a submit button on it. I want the the user to complete
all of the entries within the form. If their entries are complete and they
click on the submit button, I want a confirmation page to pop up with a
message that says "Thank you, [First Name from txtFirstName field]" and the
results to get stored in a text file. I have no idea how to code all of
this. I have made up my form using notepad because I hate front page. can
someone PLEASE help me with this matter?
If the form is not complete, I will use vbscript to deal with this error. I
can manage this part though. It's the Confirmation page that I am having
difficulty with.
Also, my second question is: I am using notepad to create all of my web
pages because I read that you'd have more control over the way your web page
looks if you use Notepad. I hate using Frontpage because of all the extra
code it generates. Is notepad the best way to code the web pages? or
should I use Frontpage? My web site is getting bigger and bigger and
sometimes notepad can be a bit archaic. Someone suggested to me that I use
Interdev... but is that any different from Front Page? am I approaching
the coding of my web site correctly by using notepad?
Thanks,
Emily
Message #6 by "Peter Lanoie" <planoie@e...> on Mon, 16 Apr 2001 15:36:20 -0400
|
|
To answer your question about how you should code your site:
Code it in whatever makes you most comfortable. :) Interdev is technically
no different from notepad from a standpoint of editing and saving text
files, but it includes a multitude of additional features that allow for a
much easier time doing so. It does have a "design" mode, but you don't have
to use it.
I use various plain text editors a lot of the time. Combine that with a .ASP
file extension re-association to said text editor and a lightening fast
"ALT-Tab", sometimes it's easier than dealing with interdev's overhead,
particularly when not working with a frontpage web project file. Otherwise,
most of my work is done in interdev when working on the various web projects
that are based on our central development server.
Peter
-----Original Message-----
From: Emily Uyeda [mailto:e-uyeda@h...]
Sent: Monday, April 16, 2001 2:44 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Help with a Form!
I have a form with a submit button on it. I want the the user to complete
all of the entries within the form. If their entries are complete and they
click on the submit button, I want a confirmation page to pop up with a
message that says "Thank you, [First Name from txtFirstName field]" and the
results to get stored in a text file. I have no idea how to code all of
this. I have made up my form using notepad because I hate front page. can
someone PLEASE help me with this matter?
If the form is not complete, I will use vbscript to deal with this error. I
can manage this part though. It's the Confirmation page that I am having
difficulty with.
Also, my second question is: I am using notepad to create all of my web
pages because I read that you'd have more control over the way your web page
looks if you use Notepad. I hate using Frontpage because of all the extra
code it generates. Is notepad the best way to code the web pages? or
should I use Frontpage? My web site is getting bigger and bigger and
sometimes notepad can be a bit archaic. Someone suggested to me that I use
Interdev... but is that any different from Front Page? am I approaching
the coding of my web site correctly by using notepad?
Thanks,
Emily
Message #7 by Roger Balliger <Roger@i...> on Mon, 16 Apr 2001 12:42:34 -0700
|
|
Emily,
I love Interdev for ASP and Homesite for HTML. When I need to look at
something in a hurry, I use Metapad (a Notepad replacement) because it has a
lot of the amenities we coders are used to. You should be able to download
a free copy of Metapad and an eval copy of Homesite. Interdev comes with MS
Visual Studio and is pricey if you can't get a copy somewhere.
The form section of your webpage should call a processing ASP type page
which serves 2 purposes:
1) produce a confirmation message such as:
response.write "Thank you, "
response.write request.form("txtFirstName")
2) Process the data by writing it to a text file. I know FrontPage page
will automatically spew out some code to do this, but you would be better
off writing your own code form an ASP book.
Roger
-----Original Message-----
From: Emily Uyeda [mailto:e-uyeda@h...]
Sent: Monday, April 16, 2001 11:44 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Help with a Form!
I have a form with a submit button on it. I want the the user to complete
all of the entries within the form. If their entries are complete and they
click on the submit button, I want a confirmation page to pop up with a
message that says "Thank you, [First Name from txtFirstName field]" and the
results to get stored in a text file. I have no idea how to code all of
this. I have made up my form using notepad because I hate front page. can
someone PLEASE help me with this matter?
If the form is not complete, I will use vbscript to deal with this error. I
can manage this part though. It's the Confirmation page that I am having
difficulty with.
Also, my second question is: I am using notepad to create all of my web
pages because I read that you'd have more control over the way your web page
looks if you use Notepad. I hate using Frontpage because of all the extra
code it generates. Is notepad the best way to code the web pages? or
should I use Frontpage? My web site is getting bigger and bigger and
sometimes notepad can be a bit archaic. Someone suggested to me that I use
Interdev... but is that any different from Front Page? am I approaching
the coding of my web site correctly by using notepad?
Thanks,
Emily
Message #8 by "Drew, Ron" <RDrew@B...> on Tue, 17 Apr 2001 08:36:19 -0400
|
|
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C0C73B.00C48190
Content-Type: text/plain
InterDev is good but it does cost. Depending on how many pages you are
looking at, take a look at http:www.coffeecup.com . For $50 it aint bad!!
I use it for the 6 websites I have. Your question regarding confirmation.
If you just want a Thank You with the name and you are using vbscript or
javascript, just create a msgbox for a quick solution and then request.form
to save the fields entered.
Ron
-----Original Message-----
From: Emily Uyeda [mailto:e-uyeda@h...]
Sent: Monday, April 16, 2001 2:44 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Help with a Form!
I have a form with a submit button on it. I want the the user to complete
all of the entries within the form. If their entries are complete and they
click on the submit button, I want a confirmation page to pop up with a
message that says "Thank you, [First Name from txtFirstName field]" and the
results to get stored in a text file. I have no idea how to code all of
this. I have made up my form using notepad because I hate front page. can
someone PLEASE help me with this matter?
If the form is not complete, I will use vbscript to deal with this error. I
can manage this part though. It's the Confirmation page that I am having
difficulty with.
Also, my second question is: I am using notepad to create all of my web
pages because I read that you'd have more control over the way your web page
looks if you use Notepad. I hate using Frontpage because of all the extra
code it generates. Is notepad the best way to code the web pages? or
should I use Frontpage? My web site is getting bigger and bigger and
sometimes notepad can be a bit archaic. Someone suggested to me that I use
Interdev... but is that any different from Front Page? am I approaching
the coding of my web site correctly by using notepad?
Thanks,
Emily
---
SoftArtisans helps developers build robust, scalable Web applications!
Excel Web reports, charts: http://www.softartisans.com/excelwriter.html
File uploads: http://www.softartisans.com/saf.html
Transactional file management: http://www.softartisans.com/saf1.html
Scalability: http://www.softartisans.com/saxsession.html
ASPstudio value pack: http://www.softartisans.com/aspstudiosuite.html
$subst('Email.Unsub')
|
|
 |