Default value of a checkbox is returning "1", even if it has been defined to "true".

If you create a custom page like this one :

<parameterGroup>
    <name>custompage</name>
    <title>Testing checkboxes values<title>
    <parameterList>
        <booleanParameter>
            <name>myBoolean</name>
            <description>I'm a checkbox</description>
            <value>true</value>
            <default>true</default>
            <displayStyle>checkbox-left</displayStyle>
        </booleanParameter>
    </parameterList>
    <postShowPageActionList>
        <showInfo text="Checkbox value: ${myBoolean}" />
    </postShowPageActionList>
</parameterGroup>

and go to the next page without unchecking/checking the checkbox, it will display: Checkbox value: 1 Whereas if you uncheck and then check again the checkbox, you will obtain: Checkbox value: true

To avoid this problem, you have to test whether the boolean equals "1" or "true":

            <ruleList>
                <ruleGroup ruleEvaluationLogic="or">
                    <ruleList>
                        <compareValues>
                            <logic>equals</logic>
                            <value1>${myBoolean}</value1>
                            <value2>1</value2>
                        </compareValues>
                        <compareValues>
                            <logic>equals</logic>
                            <value1>${myBoolean}</value1>
                            <value2>true</value2>
                        </compareValues>
                    </ruleList>
                </ruleGroup>
            </ruleList>

But I think checkboxes should always return the same type of value.

asked 14 Jun '13, 11:34

Nicolas%20Jauffret's gravatar image

Nicolas Jauf...
1112
accept rate: 0%


I don't really see a question here, but if you had asked how to handle the different values ("1", "yes", "true"), then I'd upvoted the answer you have given yourself already: testing the value using the <istrue> or <isfalse> rule ;-)

link

answered 14 Jun '13, 12:30

Dirk%20Stegemann's gravatar image

Dirk Stegemann
681283244
accept rate: 31%

Thank you for the hint.

It helps solving the problem ; but it does not cure the symptom.

Regards.

link

answered 14 Jun '13, 12:37

Nicolas%20Jauffret's gravatar image

Nicolas Jauf...
1112
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×10
×10
×6
×5
×3
×3

Asked: 14 Jun '13, 11:34

Seen: 1,905 times

Last updated: 14 Jun '13, 12:37