Announcement

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

    IntegerItem not enforcing length

    Isomorphic,

    After upgrading to SmartClient Version: v10.1p_2016-11-13/Pro Deployment (built 2016-11-13), setting the length on an IntegerItem no longer limits the user input to this length.

    This was working with SmartClient Version: v10.1p_2016-08-25/Pro Deployment (built 2016-08-25).

    Thanks

    #2
    This has been fixed for builds dated January 9 and later.

    Comment


      #3
      Isomorphic,

      I applied the January 9 build and the user input is now limited, however, I'm seeing a new issue that may be related to the fix.

      If an IntegerItem has a default value. For example,

      Code:
      IntegerItem integerItem = new IntegerItem("Integer");
      integerItem.setLength(2);
      integerItem.setDefaultValue(1);
      Then calling getChangedValues() on the DynamicForm will contain an entry for the field even if the field has not been modified. The changed value for the field contains the following.

      Code:
      {Class=Number, stringify=function isc_c_NumberUtil__stringify(_1,_2,_3,_4){if(_3==null)_3=this;if(!_1)_1=2;var _5=(_4!=null?_3.toString(_4):_3.toString()),_6=_1-_5.length;if(_2){var _7=_5.indexOf(isc.dot);if(_7!=-1){_6+=(_5.length-_7)}}
      var _8=isc.NumberUtil.$eg(_6);if(_8==null)return _5;return _8+_5}, isBetween=function isc_c_NumberUtil__isBetween(_1,_2,_3,_4){if(_4==null)_4=this;var _5=Math.min(_1,_2),_6=Math.max(_1,_2);if(_3){return _5<=_4&&_4<=_6}else{return _5<_4&&_4<_6}}, toCurrencyString=function isc_c_NumberUtil__toCurrencyString(_1,_2,_3,_4,_5){if(_5==null)_5=this;var _6=_5<0,_7=_5<0?Math.ceil(_5):Math.floor(_5),_8=Math.abs(Math.round((_5-_7)*100)),_9=isc.StringBuffer.create();_7=Math.abs(_7);_1=_1||isc.NumberUtil.currencySymbol||"$";_2=_2||isc.NumberUtil.decimalSymbol||".";if(_3==null)_3=true;if(_6)_9.append(isc.NumberUtil.negativeSymbol||"-");if(_4!=true)_9.append(_1);_9.append(_7.stringify(1));if(_3){_9.append(_2);_9.append(_8.stringify(2))}else if(_8!=0){_9.append(_2);if(_8%10==0)_9.append(_8/10);else _9.append(_8.stringify(2))}
      if(_4==true)_9.append(_1);return _9.release(false)}, iscToLocaleString=function isc_Numbe_iscToLocaleString(){var _1=isc.NumberUtil.iscToLocaleString(this);return _1}, toFormattedString=function isc_Numbe_toFormattedString(_1){var _2=isc.NumberUtil.toFormattedString(this,_1)
      return _2}, toLocalizedString=function isc_Numbe_toLocalizedString(_1,_2,_3,_4){var _5=isc.NumberUtil.toLocalizedString(this,_1,_2,_3,_4);return _5}, toUSString=function isc_Numbe_toUSString(_1){var _2=isc.NumberUtil.toUSString(this,_1);return _2}, toUSDollarString=function isc_Numbe_toUSDollarString(_1){return isc.NumberUtil.toUSCurrencyString(this,_1)}, toUSCurrencyString=function isc_Numbe_toUSCurrencyString(_1){var _2=isc.NumberUtil.toUSCurrencyString(this,_1);return _2}}
      Thanks.

      Comment


        #4
        Hi Isomorphic,

        Do you have an update for the default value issue?

        Thanks.

        Comment


          #5
          Yes, the fix for this issue hit 6.x builds yesterday - we'll port it back to 5.1 today and you can retest with a build dated January 14 or later.

          Comment


            #6
            Thanks. The default value issue appears to be resolved.

            I did notice a change in behavior when I was verifying the fix. When loading a record and the underlying value for the IntegerItem exceeds the specified length, the displayed value is truncated now. The IntegerItem used to display the value without truncating it. That is, the length only applied to user input. We rely on the previous behavior in our application. Is there any way to prevent the displayed value for an IntegerItem from being truncated now?

            Thanks.

            Comment


              #7
              Hi stonebranch3,

              did you already see TextItem.setEnforceLength()? It was added in 5.0 and defaults to true.

              Best regards
              Blama

              Comment


                #8
                Hi Blama,

                We are making use of setEnforceLength for our custom TextItem/TextAreaItem items, however, it didn't seem to be needed for IntegerItem originally. I have tested setting it to false on an IntegerItem and it does prevent the value from getting truncated so I will make this change.

                Thanks!

                Comment


                  #9
                  Before these recent changes, numeric items were not attempting to enforce length at all in some cases because the values in use were numbers, and some internal logic ran only for strings.

                  In latest builds, Blama is correct - setEnforceLength() now behaves as doc'd for numeric-items as well as string-based ones.

                  Comment


                    #10
                    OK, that's good to know. Thanks.

                    Comment

                    Working...
                    X