Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics 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 December 11th, 2004, 06:07 AM
Registered User
 
Join Date: Dec 2004
Location: , , United Kingdom.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 0 entry prob

Hi all ASP heads,
I've got a inc file as follows:-
<%

Sub AddToCartForm
  Response.Write "<form action='addtocart.asp' method='get'>" &_
      [u]"<input type='text' name='qty' value='1' size='1'>" </u>&_
    "<input type='hidden' name='Price' value='" & FormatNumber(myRS("Price"),2) &_
    "'><input type='hidden' name='ProductID' value='" & myRS("ProductID") &_
    "'><input type='hidden' name='CartID' value='" & CartID &_
    "'><input type='submit' value='add to basket'></form>"
End Sub

%>

The prob is that i need to let users enter an amount in the 'qty' box but i don't want them to enter a zerro (0) amount what code should i put in this library file to stop them from doing so.
Cheers much help welcome :)

Dreamdragon
 
Old December 11th, 2004, 06:23 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

library file?????

;;;i don't want them to enter a zerro (0)

Two options come to mind
1..Make it a select box including only the options you want then to choose
2..When you validate your form (do you validate your form using JS?) throw in this inside your validation function:
if (document.form.qty == 0)
{
   alert("zeros not allowed, enter another number.");
   document.form.qty.focus();
   document.form.qty.select();
   return false;
}

Wind is your friend
Matt
 
Old December 12th, 2004, 06:47 AM
Registered User
 
Join Date: Dec 2004
Location: , , United Kingdom.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Cheers Mat, I'll try including the JS validation. LIBRARY file yep, it's just wot i call it, it's a file that hasn't got any HTML in it ,it's just the code you see above and it's called from any other file ie by an <--include--> statement.
 
Old December 12th, 2004, 05:42 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

FYI : If you talk about library files people may mistake them for a .dll (dynamic link library) I believe these are commonly referred to as library files.

Wind is your friend
Matt




Similar Threads
Thread Thread Starter Forum Replies Last Post
date entry Tim Johnson Access 1 December 26th, 2007 08:18 AM
DOUBLE ENTRY K38AT Access 1 October 23rd, 2007 12:21 PM
Transfering an entry scandalous Access 1 February 13th, 2007 08:36 AM
Always a New entry scandalous Access 3 January 26th, 2007 04:02 PM
User Entry MrDannyP Beginning VB 6 2 December 3rd, 2003 10:22 PM





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