Announcement

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

    12.0p Bug with DateItem and useTextField:true with no data in DynamicForm

    Hi Isomorphic,

    please see this online sample (v12.0p_2019-08-01) where it seems that the data for a useTextField:true-DateItem is not displayed.

    Click image for larger version

Name:	Date not displayed.png
Views:	9
Size:	38.2 KB
ID:	258891

    Testcase:
    Code:
    isc.DynamicForm.create({ 
        ID: "dynamicForm1",
        isGroup: true, groupTitle: "Form 1",
        canEdit: false, readOnlyDisplay:"static",
        dataSource: "supplyItem",
        width: 800,
        fields:[
           {name: "header", type:"header", value:"Form 1"},
           {name: "itemID"},
           {name: "itemName"},
           {name: "SKU"},
           {name: "category"},
           {name: "unitCost"},
           {name: "units"},
           {name: "inStock", labelAsTitle:true},
           {name: "nextShipment"},
           {name: "description", showIf:"dynamicForm1.getValue('description') != null"},
        ]
    });
    
    isc.DynamicForm.create({ 
        ID: "dynamicForm2",
        canEdit: false, readOnlyDisplay:"static",
        dataSource: "supplyItem",
        width: 800,
        fields:[
           {name: "header", type:"header", value:"Form 2"},
           {name: "itemID"},
           {name: "itemName"},
           {name: "SKU"},
           {name: "category"},
           {name: "unitCost"},
           {name: "units"},
           {name: "inStock", labelAsTitle:true},
           {name: "nextShipment", type:"date", useTextField:true},
           {name: "description", showIf:"dynamicForm2.getValue('description') != null"},
        ]
    });
    
    
    isc.IButton.create({
        ID: "toggleEditButton1",
        title: "Toggle canEdit1",
        click: "dynamicForm1.setCanEdit(!dynamicForm1.canEdit)"
    });
    
    isc.IButton.create({
        ID: "toggleEditButton2",
        title: "Toggle canEdit2",
        click: "dynamicForm2.setCanEdit(!dynamicForm2.canEdit)"
    });
    
    
    isc.IButton.create({
    ID:"printBtn",
                autoDraw: false,
                title: "Print Preview",
                click: "isc.Canvas.showPrintPreview([dynamicForm1, dynamicForm2])"
            });
    
    isc.HStack.create({
        ID: "buttons",
        height: 24,
        membersMargin: 10,
        members: [toggleEditButton1, toggleEditButton2, printBtn]
    });
    
    isc.VLayout.create({
        width: 800,
        membersMargin: 10,
        members: [dynamicForm1, dynamicForm2, buttons]
    });
    
    dynamicForm1.fetchData({ fieldName: "SKU", operator: "equals", value: "90600" });
    dynamicForm2.fetchData({ fieldName: "SKU", operator: "equals", value: "90600" });
    Best regards
    Blama

    #2
    The problem here is actually just that the data you're viewing happens not to have a value in it's Next Shipment field - a picker-based DateItem will enforce a default value (Today), because they don't support a null representation. But a useTextField:true DateItem *does* support null values and will not enforce Today as a default value.

    You can either set a defaultValue on the item, or you can use a record that has a value in that field.
    Last edited by Isomorphic; 4th Aug 2019, 22:07.

    Comment


      #3
      Hi Isomorphic,

      thanks. Stupid mistake not to notice that the date is the current date.
      I agree that the current date as default makes sense for a useTextField:false DateItem. I also understand that this does not support nulls.
      This means that useTextField:false DateItem should most likely only be used with required="true" fields. IMHO it would be good if the docs mentioned this.

      Also it would be good if a useTextField:true DateItem automatically switched to useTextField:false when in the following mode:
      • canEdit: false
      • readOnlyDisplay:"static"
      • disabled: false
      As you can see, the value display is strange in the FormItem in the 1st DynamicForm of the screenshot anyway and looks way better in useTextField:true.

      Best regards
      Blama

      Comment


        #4
        We agree on both points - DateItem.useTextField was re-doc'd a week or so ago with some additional notes and links, and you should see useTextField switching on and off automatically according to the state of the item / its form as of builds dated August 14.

        Comment


          #5
          Hi Isomorphic,

          I saw the docs change. It makes it way clearer, thank you.

          W.r.t the DateItem change you made, I can see it in SNAPSHOT_v12.1d_2019-08-14 only, not in v12.0p_2019-08-14.
          Also, in 12.1d it is now somewhat broken with the sample code from #1:
          • On click on "Try it" the date shows up for a very short time.
          • Then it is hidden
          • On click on "Toggle canEdit1" the default date (today) shows.
          • On click on "Toggle canEdit1" again, the default date (today) is displayed read only.
          I'm not sure what I would expect here, no date or today (I assume the latter)? But the flickering is definitely wrong.
          If I explicitly set a default with {name: "nextShipment", defaultValue:"12/01/2019"} the default date (Dec, 1st) shows.

          Best regards
          Blama

          Comment


            #6
            We do see the value disappear in the online showcase, but not elsewhere - we'll look into that and get back to you.

            We're not sure what you mean about flickering - do you just mean that you see the value appear once and then it disappears?

            The default value of Today is applied at creation, to the useTextField: false item - so, it is fully expected that when we switch to useTextField:true automatically after creation, due to changes in item/form state, the textField is going to display the default from the item.

            Comment


              #7
              Hi Isomorphic,

              yes, by "flickering" I meant the value first showing and then disappearing.

              This is the only issue I saw. When applying a explicit default everything is fine IMHO, regardless of useTextField: true/false. My last sentence in #5 was an observation, not a bug report.

              Best regards
              Blama

              Comment


                #8
                You should find this fixed in builds of 12.1 dated August 17. We'll port back to 12.0 shortly.

                Comment


                  #9
                  Hi Isomorphic,

                  I can see this is fixed in v12.0p_2019-08-18 and SNAPSHOT_v12.1d_2019-08-18.

                  Thank you & Best regards
                  Blama

                  Comment

                  Working...
                  X