Announcement

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

    transformInput on formitem bug in Chrome/Safari

    Tried with SC_SNAPSHOT-2011-05-13/PowerEdition Development Only (built 2011-05-13)

    Run this sample in Chrome. You'll notice that the cursor pointer goes to the front of the new character added instead of the end of the whole string causing any new input to be appended before the last character. Note that the actual functionality of our transformInput is not the same as the sample below, but follows the same idea of appending a character in the current value.

    This problem is not reproduceable in IE or FF

    Code:
    isc.DynamicForm.create({
        width: 300,
        fields: [
            {title:"Item", type:"text", transformInput: function(form, item, value, oldValue){
                   return value+"1";
            }} 
        ]
    });
    Last edited by acarur01; 17 May 2011, 11:56.

    #2
    Right, transformInput is used for a variety of different use cases, and not all them should move the insertion position, so we don't move it by default.

    Comment


      #3
      So...what do you recommend then? This is obviously not something that can be ignored - plus, if you're not doing anything with the position, who is? It behaves differently in other browsers

      Comment


        #4
        Let's start with what problem you're trying to solve - you may or may not be looking at the right APIs to solve it.

        Comment


          #5
          Our product has a need for automatic formatting of numbers. Insertion of commas when needed (ex. user enters 123 then enters 4, the value should be transformed to 1,234) or when a field has length of 5 and precision of 2, user inputs 123 then enters 4 the value should have transformed to 123.40, etc

          Comment


            #6
            There's a feature designed specially for that - text masking. Do you have some reason you're not using that?

            Comment


              #7
              As far as I understand, text masking requires that we know the exact length of a field value. I cannot just say #,### because text masking will put _,___ in the field when most times, this isn't true in our product. A field can have up to maybe 100 numbers...we can't do #,###,### for one hundred numbers.

              Comment


                #8
                You are correct - the masked textitem does not support variable length masks for numbers at present.

                Comment


                  #9
                  Ok we've added some logic to ensure that if transformInput modifies an item's value while the user is typing in the field, focus ends up at the end of the field.

                  Comment


                    #10
                    Confirmed in build 5-18 - works on all browsers now. Thanks.

                    Comment

                    Working...
                    X