Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > ASP Forms
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 13th, 2003, 08:37 PM
Authorized User
 
Join Date: Jul 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Adding form fields before submit is clicked?

I have multiple fields that need to be added while the user is entering data, but all I get is the numbers displayed side by side:

strFormName = Request("FormName")
strSubject = Request("subject")
strSendTo = Request("SendTo")
strNumber = Request("txtNumber")
intSize2 = Request("Size2")
intSize3 = Request("Size3")

total = intSize2 + intSize3

any ideas?

Dan
 
Old July 14th, 2003, 03:21 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Not sure what you mean, because your subject says "before submit is clicked", which sounds like a client side issue and your code shows server side ASP.

Are you referring to the fact that the numbers are not added, but appended? That 2 + 2 equals 22 instead of 4?
If that's the case, convert your numbers to a "real" number data type, like a Int or a Double:

Code:
total = CInt(intSize2) + CInt(intSize3)
If this is not what you're after, please be more specific.

Cheers,

Imar



---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old July 14th, 2003, 08:35 AM
Authorized User
 
Join Date: Jul 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks that's exactly it...

 
Old July 16th, 2003, 08:58 AM
Authorized User
 
Join Date: Jul 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Now the problem I have is if there is nothing in the field it causes a page fault, how can I have it look and see if there is a numnber, if not replace it with a zero?

Thanks

 
Old July 16th, 2003, 11:04 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Dan,

You can check the length of the variable's value like this:

Code:
total = intSize2 + intSize3
If Len(total) = 0 Then
    total = 0
Else
    ' Convert it to a Integer
    total = CInt(total)
End If
Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Form does not open when commandbar button clicked Arsi BOOK: Professional Outlook 2007 Programming ISBN: 978-0-470-04994-5 21 March 5th, 2009 04:03 AM
How 2 Send Email When Submit Clicked BrianWren ASP.NET 1.0 and 1.1 Professional 4 April 21st, 2006 11:55 AM
How can we submit a form without a submit butto phpsharma BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 4 October 20th, 2003 08:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.