Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    CheckBoxItem and defaultValue

    Hi. I've encountered an annoying little problem when setting the default value of a checkbox to "true".
    If I create the item in JavaScript:
    Code:
    isc.DynamicForm.create({
        fields: [
            {title:"In Stock", type:"checkbox", defaultValue:true}
        ]
    });
    it works. However if I create the same item in XML:
    Code:
    <DynamicForm width="300">
        <fields>
            <field title="In Stock" type="checkbox" defaultValue="true"/>
        </fields>
    </DynamicForm>
    then the checkbox needs to be clicked twice before it is cleared.

    SmartClient 8.3
    FF18 and IE9

    #2
    Instead of <field> use <CheckboxItem>.

    Comment


      #3
      Thanks the the quick reply. Unfortunately <CheckboxItem> behaves in the same way as <field>.

      Comment


        #4
        We just double-checked, the following works as expected:

        Code:
        <DynamicForm width="300" autoDraw="true">
            <fields>
                <CheckboxItem title="In Stock" type="checkbox" defaultValue="true"/>
            </fields>
        </DynamicForm>

        Comment


          #5
          You're right! But as well as using <CheckBoxItem>, I also need to set autoDraw="true" in the <DynamicForm>.

          Thanks for your help.

          Comment


            #6
            No, that has no effect on the behavior (we just double-checked that too).

            The first time you tried, you probably just had a typo.

            Comment


              #7
              Hang my head in shame.

              I was using CheckBoxItem instead of CheckboxItem.

              Comment


                #8
                No worries. Note that if you get the spelling wrong you should see a warning in the Developer Console, so keep an eye out for those.

                Comment

                Working...
                X