Announcement

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

    Hidden fields on Dynamic Form still appear

    1. SmartClient Version: v9.1p_2014-07-23/Pro Deployment (built 2014-07-23)
    2. Build identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0
    3. N/A
    4. N/A
    5. N/A
    6. Code follows

    The important field is named "fieldToHide" which is unfortunately no longer hidden despite the "hidden" flag set to true. This has led to many "hidden" fields appearing on my application. The latest build (10.0p Built 2014-10-22) has this bug and so does the v9.1p_2014-07-23/Pro Deployment (built 2014-07-23) which is my production deployment.

    Navigate to the following link which is the Hands on demo of SmartClient (currently running 10.0p Built 2014-10-22)
    DataBinding --> Validation --> Customized Binding (http://www.smartclient.com/#validationFieldBinding)

    Under the "users.dx.xml" tab, paste in
    Code:
    <DataSource ID="users">
        <fields>
            <field name="fieldToHide" title="Field to hide" type="text" required="true" length="50"/>
            <field name="firstName" title="First Name" type="text" required="true" length="50"/>
            <field name="lastName" title="Last Name" type="text" required="true" length="50"/>
            <field name="email" title="Email" type="text" required="true" length="100">
                <validators>
                    <validator type="regexp" 
                               expression="^([a-zA-Z0-9_.\-+])+@(([a-zA-Z0-9\-])+\.)+[a-zA-Z0-9]{2,4}$"/>
                </validators>
            </field>
            <field name="password" title="Password" type="password" required="true" length="20"/>
        </fields>
    </DataSource>
    Under the "customBinding.js" tab, paste in
    Code:
    isc.DynamicForm.create({
        ID: "boundForm",
        colWidths: [100, 200],
        dataSource: "users",
        useAllDataSourceFields: true,
        fields: [
            {name: "fieldToHide",title : "Overriden title", hidden: true},
            {type:"header", defaultValue:"Registration Form"},
            {name: "password"},
            {name: "password2", title: "Password Again", type: "password", required: true, 
             length: 20, validators: [{
                 type: "matchesField",
                 otherField: "password",
                 errorMessage: "Passwords do not match"
             }]
            },
            {name: "acceptTerms", title: "I accept the terms of use.", type: "checkbox", width:150,
             defaultValue:false,
             validators:[{
                type:"custom",
                condition:"return value == true",
                errorMessage:"You must accept the terms of use to continue"
             }]
            },
            {name: "validateBtn", title: "Validate", type: "button", click: "form.validate()"}
        ],
        values : {
            firstName: "Bob",
            email: "bob@.com",
            password: "sekrit",
            password2: "fatfinger"
        }
    });
    Trying out this sample leads to the screenshot "HiddenFieldsStillAppearing" with the title being correctly overridden but with the "hidden" flag not respected.

    I would need the fix in SmartClient Version: v9.1p_2014-07-23/Pro Deployment (built 2014-07-23)
    Attached Files

    #2
    "hidden" is not a supported attribute on FormItems.
    We support setting DataSourceField.hidden - this will ensure that the field isn't picked up in any dataBound components unless it's explicitly listed out in the fields array, but setting this property on your item configuration as in your example code will have no effect.
    Instead you can specify
    Code:
        showIf:"false"
    within the item definition to ensure the form item doesn't show up.

    Regards
    Isomorphic Software

    Comment


      #3
      Issue Fixed - Surfing on unintended behaviours

      Issue is resolved. Thanks.

      For those that might be interested....

      I rechecked the behaviour of the "hidden" flag on a few older versions
      1) SmartClient Version: v8.2p_2013-04-05/LGPL Development Only (built 2013-04-05)
      2) SmartClient Version: v8.3p_2013-08-19/LGPL Development Only (built 2013-08-19)
      3) SmartClient Version: v9.0p_2014-01-24/Pro Deployment (built 2014-01-24)
      4) SmartClient Version: v9.1p_2014-07-23/Pro Development Only (built 2014-07-23)

      The versions 8.X.X and 9.0.X do hide the field but the doc does not list the "hidden" flag as a FormItem property. Seems that it was an unintended behaviour that was fixed in version 9.1.X onwards.
      Last edited by Vivek_Gungabissoon; 27 Oct 2014, 10:20. Reason: Added an additional version

      Comment


        #4
        Thanks for the clear list.
        Also - after some internal discussion, given that FormItem.hidden used to be respected (albeit inadvertently), we're going to go ahead and add support for this as essentially a synonym for showIf:"false".

        We'll follow up when this change makes it into nightly builds.

        Regards
        Isomorphic Software

        Comment


          #5
          Backward compatibility

          Thanks for the backward compatibility fix. It's not a major issue anymore (for me) since the "showIf" flag easily fixes the problem of the unhidden "hidden" fields.

          Of course, there might be some baffled soul out there pondering why so many fields have magically appeared in the app and the backwards compatibility fix will definitely help... :-)

          Comment


            #6
            We've now added FormItem.hidden as a synonym for setting showIf:false.
            This change appears in mainline only (10.1d), and will exist in nightly builds going forward (Jan 10 and above)

            Regards
            Isomorphic Software

            Comment

            Working...
            X