MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Problem with persistent checkboxes and refresh and solution



Hi all

I just solved a problem which appeared on my cart page, and perhaps you're
interested as well.

We have a special programme for our customers called Joker, and the customer
should be able to check a checkbox and then see how much he would save if he
chose to be a Joker member. He can then uncheck (is this the right word?) it
again and see the non-Joker prices.

(Remember, I'm pretty new to MiniVend...)

So I made a checkbox:
   <input type=checkbox name="joker" [checked joker on] value="on"
   onClick="this.form.action='[process-target]';this.form.submit();">
   [loc]I am a Joker member.[/loc]

This worked when you checked the checkbox, but after that the checkbox
remained checked all the time. Apparently, when you uncheck a checkbox, the
CGI value is just undefined and is not transmitted. A quick look into the
MiniVend session file showed me that "joker" was in fact still set to "on".
And "on" it would remain until the end of time...

A colleague gave me the idea to check the checkbox all the time and set it
to another value. Which is what I did with a bit of Javascript:
   <input type=checkbox name="joker" [checked joker on] value="on"
 
onClick="checkJoker(this);this.form.action='[process-target]';this.form.subm
it();">
   [loc]I am a Joker member.[/loc]

(This is in the <head>)
    <script language="JavaScript" type="text/javascript">
    <!--
    function checkJoker(checkbox) {
        if (checkbox.checked == true) {
            checkbox.value = 'on';
        } else {
            checkbox.checked = true;
            checkbox.value = 'off';
        }
    }
    //-->
    </script>

And it works! Perhaps there are simpler solutions to this problem and if so,
I'd like to hear about them! :-)

Best regards,
Eric
----------------------------------
   Swisscom AG      		mailto:eric.lewis@swisscom.com
   Informatik
   Eric Lewis, CIT-AE-742
   Postfach               		phone	+41-31/342 79 71
   CH-3050 Bern       		fax	+41-31/342 90 69
----------------------------------


Search for: Match: Format: Sort by: