Announcement

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

    MaxLength does not behave as in native browser components

    ISC version: SmartClient_v90p_2014-01-24_Pro

    We specify "length" attribute on the "text" datasource fields in order to limit the user's input (in order to comply with the DB schema).

    We'd like the form items to behave the same way as the native browser components do:
    when you reach the maximum number of characters, you can NOT type anything else in the fields.

    Steps to illustrate the problem:
    1. Type "0123456789" in the form field. This reaches the fields' max length: when your cursor is at the end of the selection, you can NOT type anything else.
    2. Move your cursor to the beginning of the field (left most position)
    3. Type "z".

    In ISC, you end up with "z012345678". The "9" has been dropped out of the field.

    In native form component, you can NOT type "z". Your initial input remains unchanged.

    We consider ISC's behaviour to be wrong.

    In a simplistic example as the one I built, it's obvious the content changes because you see the whole content.

    But, imagine you have a text field that supports 2000 characters and the textarea does not show all the content (scrollbar displayed). A user wants to add something at the top of his text box. How can a user figure he's currently destroying the end his previous value ?

    Are there attributes we can enable/change to support the behaviour we want ?

    Here are the code snippets I used to build my example.

    ISC form:
    Code:
    isc.DataSource.create({
        ID: 'myDs',
        fields: [{
            name: 'comment',
            type: 'text',
            length: 10
        }]
    });
    
    var vm = ValuesManager.create({
        dataSource: 'myDs'
    });
    
    isc.DynamicForm.create({
        width: 400,
        valuesManager: vm,
        fields: [{
            name: 'comment',
            title: "TextArea",
            type: "textArea",
            maxLength: 10
        }]
    });
    Native form:
    Code:
    <html>
    	<body>
    		<form>
    			Native : <textarea maxlength="10"></textarea>
    		</form>
    	</body>
    </html>
    Thanks !

    #2
    Just a note to say we agree this is not behaving correctly and are working on it. We'll let you know when we have a fix in place so the user can't alter the string in this way by putting focus at the beginning of the field and typing.

    Regards
    Isomorphic Software

    Comment


      #3
      We've made a change to address this issue in the 9.0p and 9.1p branches
      In 10.0 we've made a couple of additional changes in this area.
      Now when a field.length is specified we automatically create an appropriate lengthRange validator on both the client and server (for SmartClient-server backed DataSources only, obviously), if one doesn't already exist.
      We've also added a new attribute - "enforceLength" to both TextItem and TextAreaItem - if true, the user is disallowed from editing more than the specified number of characters If false the user can enter additional characters (but the new validators will flag an error on a save attempt).

      We've also disabled "enforceLength" by default on TextAreaItem. This is a behavioral change from 9.x and will be called out as such in the release-notes. It can be reversed, if desired, by globally setting "enforceLength" to true for all TextAreaItems within an application.

      Changes will all be in the next nightly build (June 18 or above)

      Regards
      Isomorphic Software

      Comment


        #4
        Thanks for the update !

        Comment

        Working...
        X