Hi Kanwei, and thanks for your reply.

I might have missed something really big but I'm kinda confused.

I just double checked galaxy-dist and galaxy-central on bitbucket and I would like to know if I understood the code properly. Please correct me if I'm wrong.

Let's look at the is_checked() method of the CheckboxField class in the lib/galaxy/web/form_builder.py file:

If I'm not mistaken, it relies on the fact that if the checkbox is checked, the request will get two values (the checkbox and the hidden field) and if it is not, it will only get one value (the hidden field) since they bear the same name.

The first part is the conditional that checks if the value is True: That means that there is only one value, so the checkbox must be unchecked. Therefore it tests the hidden field's value. It will return True if the hidden field's value is true.

The second part is only executed if the above condition is false: this means either the checkbox is actually checked, or it is unchecked and the hidden field is false. It returns true if there are two values, i.e. if the checkbox is checked. If the hidden field is false, it will obviously return False.

So, let's see both cases:

- 1st case: the hidden field is true: If the checkbox is unchecked, the method will return True in the first part. If it is checked, it will also return True in the second part.

- 2d case: the hidden field is false: If the checkbox is checked, like in the 1st case, the second part will return True. But if it is unchecked, the first part won't return anything since the received value is not True. So it will return the result of the second part which is false since False is not an instance of list.

Now my questions are: Did I miss anything? If not, how can the first case work for you? Wouldn't there be some cases where a checkbox actually gives a value even if it is unchecked, and a field is ignored of there is already one with the same name?

Thanks,
L-A


Le 24/08/2011 19:36, Kanwei Li a écrit :
Hi L-A,

I tried this on today's tip but could not reproduce the bug. I added your param "<param name="SQA" type="boolean" label="Run SolexaQA" checked="true" />" to a tool and the correct value was produced on the command line and in the <configfiles> block as well. Re-running also gave the correct result. Are you still seeing this problem?

Thanks,

K

2011/8/15 Louise-Amélie Schmitt <louise-amelie.schm...@embl.de <mailto:louise-amelie.schm...@embl.de>>

    Hello,

    Sorry for being late, again, but please find the tool attached.

    Here is my last pull: 5743:720455407d1c

    Stuff changed in the file but in the end I had to make the same
    modification again (change true to false) since it didn't work
    anymore.

    Best,
    L-A



    Le 15/06/2011 09:56, Louise-Amélie Schmitt a écrit :

        Hi, and sorry for the late reply

        Here is the last pull: 5355:50e249442c5a

        I'll try to be as concise as I can but I can send you the
        whole file if you need it. It's not completely done yet though.

        This is a tool that produces a HTML file containing the
        results of various quality assessment programs. To trigger or
        block the execution of a specific program, I use checkboxes in
        the form, like this:
        <param name="SQA" type="boolean" label="Run SolexaQA"
        checked="true" />

        Then, I use the <configfile name="script"> tags to define a
        shell script that will be modified with cheetah tests on the
        checkboxes.

        Then the final script is sent to another shell script  that
        will check its existence and launch it:
        <command interpreter='sh'>all_QA.sh $script </command>

        As you can see, the checkboxes are checked by default. But
        before the change I mentioned is my last email, un-checking
        them didn't have any effect whatsoever. The following test,
        for instance, was always true:
        #if $SQA.value == True

        Moreover, even if I un-checked the checkboxes and ran the
        tool, then clicked the re-run button in the result in my
        history, all of them were checked in the form that appears, as
        if I never un-checked them.

        Now, the state of the checkboxes is respected and I can
        properly choose what to run in my tool.

        Hope that helps.
        L-A


        Le 08/06/2011 20:54, Jennifer Jackson a écrit :

            Hi L-A,

            Could you describe a use case (which tool/from, what
            options/input)? If you know the last pull # for your local
            install, that would also be helpful for us to know.

            Best,

            Jen
            Galaxy team

            On 6/6/11 2:15 AM, Louise-Amélie Schmitt wrote:

                Hi,

                Since I haven't updated Galaxy for a while now I don't
                know if it was
                actually fixed but I had issues with my
                default-selected checkboxes:

                When I deselected them, the value sent in the query
                remained as if they
                were still selected. Even when I re-ran the job, all
                the checkboxes were
                selected as if I never deselected them.

                Therefore, in lib/galaxy/web/form_builder.py

                I changed:
                105 return '<input type="checkbox" id="%s" name="%s"
                value="true"%s%s><input type="hidden" name="%s%s"
                value="true"%s>' \

                for:
                105 return '<input type="checkbox" id="%s" name="%s"
                value="true"%s%s><input type="hidden" name="%s%s"
                value="false"%s>' \

                And it works fine now :)

                Cheers,
                L-A
                ___________________________________________________________
                Please keep all replies on the list by using "reply all"
                in your mail client. To manage your subscriptions to this
                and other Galaxy lists, please use the interface at:

                http://lists.bx.psu.edu/



        ___________________________________________________________
        Please keep all replies on the list by using "reply all"
        in your mail client.  To manage your subscriptions to this
        and other Galaxy lists, please use the interface at:

        http://lists.bx.psu.edu/



    ___________________________________________________________
    Please keep all replies on the list by using "reply all"
    in your mail client.  To manage your subscriptions to this
    and other Galaxy lists, please use the interface at:

    http://lists.bx.psu.edu/



___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:

  http://lists.bx.psu.edu/

Reply via email to