Uploaded image for project: 'Runtime'
  1. Runtime
  2. RUNTIME-3342

OrderableTagField do not submit an empty array when no selection

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 4.3.0
    • 4.3.0
    • None
    • None
    • 4.3 RC1

      But an Empty String

      You can test the following code in Sencha Fiddle:

      var shows = Ext.create('Ext.data.Store', {
          fields: ['id','show'],
          data: [
              {id: 0, show: 'Battlestar Galactica'},
              {id: 1, show: 'Doctor Who'},
              {id: 2, show: 'Farscape'},
              {id: 3, show: 'Firefly'},
              {id: 4, show: 'Star Trek'},
              {id: 5, show: 'Star Wars: Christmas Special'}
          ]
      });
      
      Ext.create('Ext.form.Panel', {
          renderTo: Ext.getBody(),
          title: 'Sci-Fi Television',
          height: 200,
          width: 500,
          items: [{
              xtype: 'tagfield',
              fieldLabel: 'Select a Show',
              store: shows,
              displayField: 'show',
              valueField: 'id',
              queryMode: 'local',
              filterPickList: true
          }, {
              xtype: 'button',
              text: 'click me',
              handler: function(btn) {
                  var tagfield = btn.up().items.getAt(0);
                  var submitValue = tagfield.getSubmitValue();
                  console.log('is array: ' + Ext.isArray(submitValue));
                  console.log(submitValue);
              },
              scope: this
          }]
      });
      

      Thus, in Ametys application, for a multiple and enumerated parameter, the widget is "Ametys.form.OrderableTagField" and the form#getValue will not always have the same type.

        1. Capture.PNG
          21 kB
          Simon Prieul
        2. Capture2.PNG
          20 kB
          Simon Prieul
        3. Capture3.PNG
          22 kB
          Simon Prieul

            Unassigned Unassigned
            sprieul Simon Prieul (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: