Forum Moderators: open

Message Too Old, No Replies

How to sell Ice Cream

2 scoops or 3

         

grandpa

8:58 pm on Sep 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I don't sell Ice Cream, but it makes a great analogy. What I'm wondering is if there is a simple counter to total up all the scoops requested off a single page, and either accept or reject the input based on cone size and scoops requested.

Huh? Here's an example.

Say that Mary wants a cone, and that only comes with a single scoop. So if she picks 2 flavors, I want her to revise her selections and only pick one flavor - prior to sending the order off to the cart.

But Mark wants the other cone, and I can give him 3 scoops. Still, Mark wants to order 4 scoops, or maybe even 2 scoops. I need to make sure he orders just the right amount, no more or no less.

As I write this I suspect there is not an HTML solution, but instead I'll have to learn some JavaScript.

Comments or suggestions?

Thanks

txbakers

9:06 pm on Sep 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi, you are right, there is no HTML solution. You can do it client side with Javascript, which will give immediate feedback to the user and ask them to change their choices, or you can wait until the page is sent to the server and validate it on the server side code.

Then, the page would come back with the problems found.

I use both methods, depending on the severity of the problem.

To check for duplicate IDs I would do that server side. To see if a phone number has all 10 digits, I would do that client side.

grandpa

1:10 am on Sep 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks,

I've been looking around this place with keywords like 'counter' and 'JavaScript counter"; the possibilities are numerous. I've also just been testing my pages and there is no doubt that some selection validation is required.

kwasher

1:18 am on Sep 25, 2003 (gmt 0)

10+ Year Member



Hi. Maybe try doing a search on javascripts or javascripts validation. Lots of good stuff already made out there that you can plug right into your site, and free too.

I know of one specific one called 'order form validation' or something like that. I can 'sticky' the website it comes from if you want.

Hope I understood what you wanted.

Filipe

8:47 pm on Sep 26, 2003 (gmt 0)

10+ Year Member



Also, it should be noted if that this is sensitive data (i.e., you can't risk having people choose the wrong amount, money is involved, etc.) then you MUST do server-side validation, simply because:

A) Javascript is easily disabled
B) Server-side validation is generally more reliable as it is not as subject to user-error as is Javascript

A combination of both, of course, makes for a better user experience since Javascript validation doesn't require the page to reload. Multiple problems can be fixed BEFORE submission. Just don't put all your eggs in one basket.