L
Leanne
I have been using Python for only a few months part-time and have
recently had my first encounter with retrieving user input from
checkboxes. I have a problem with the way Python reads the input
values from a set of checkboxes on a webpage.
The values assigned to the checkboxes are integers. I first of all
check for a key of CHK_CHILDREN to see if any checkboxes have been
checked. That works fine.
I then use a 'for x in CHK_CHILDREN' loop to get all the values from
the returned list. This works for most cases except one. If the user
only checks 1 checkbox, Python reads a scalar, not a list, and if this
scalar is a double digit integer (eg 11), then the loop goes through
each digit and retrieves these values, eg retrieves 1 and then
retrieves 1 again.
I have created a not so elegant work-around that names each checkbox a
different name and therefore I know a scalar is returned each time, but
was wondering if anyone knows what's going here.
Thanks
recently had my first encounter with retrieving user input from
checkboxes. I have a problem with the way Python reads the input
values from a set of checkboxes on a webpage.
The values assigned to the checkboxes are integers. I first of all
check for a key of CHK_CHILDREN to see if any checkboxes have been
checked. That works fine.
I then use a 'for x in CHK_CHILDREN' loop to get all the values from
the returned list. This works for most cases except one. If the user
only checks 1 checkbox, Python reads a scalar, not a list, and if this
scalar is a double digit integer (eg 11), then the loop goes through
each digit and retrieves these values, eg retrieves 1 and then
retrieves 1 again.
I have created a not so elegant work-around that names each checkbox a
different name and therefore I know a scalar is returned each time, but
was wondering if anyone knows what's going here.
Thanks