Re: Variable quantity chooser.
| From: | Steve Werby | Date: | Thu, 08 Feb 2001 15:13:43 +0000 |
| Subject: | Re: Variable quantity chooser. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38761@lists.php.net to get a copy of this message | ||
"David VanHorn" <dvanhorn@cedar.net> wrote:
> Sorry, I've been away from this for a while.
> Let me peel back a bit.
>
> When I generate the form, I pull up from the db, the quantity on hand, and
> the quantity already committed to orders. So:
> $max=$quantity-$commit is the maximum number I can allow someone to order.
>
> In the form, I'd like to get to a mechanism that would allow entry (by
most
> any means really) of an order number >0 and less than $max.
> I know I can do it by submitting the form, but it would be irritating to
> have to do that..
>
> Maybe I should just display $max, and let it go at that.
Trust your users, do ya? <wry grin> If you don't want to handle validation
on the server side using PHP, you should probably look at a JavaScript
solution that checks to see if the number is between a given range after
some event (like the form element losing the focus) and popping up a dialog
box if it's not valid. Try internet.com's Javascript area or another JS
site to find a code snippet that does what you want.
--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/