Forum Moderators: open

Message Too Old, No Replies

code for total qty check is required

         

hozyali

10:31 pm on Aug 22, 2010 (gmt 0)

10+ Year Member



Hi,

This is a bit different. I have a php loop in which it has a sub loop to create drop downs.

so for example, I have 2 tickets, which ticket has 3 different pricing level.

so the first loop goes for 2, then subloop runs for 3, now in each main loop, I have a hidden field which has max qty value.

I need user to be able to select qty from the subloop's drop down. But they should be able to select only total of max value in the hidden field. otherwise an alert should occur.

Is it possible?

if one does not understand what I am asking, kindly ask for further clarification.

thanks very much.

alias

8:19 am on Aug 23, 2010 (gmt 0)

10+ Year Member



As far as I understand it's a simple javascript validation script.

Try searching the web for "js validation" and similar topics.

Technically, it is very simple:
- bind change events for the dropdowns, identifying them by ID's or classnames or any other way
- store the validation rules in an array with ID's or classnames as keys
- match the dropdown values against the validation array
- display or hide an error message