Announcement

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

    validateOnChange Bug?

    SmartClient Version: v8.2p_2012-05-24/PowerEdition Deployment (built 2012-05-24)
    IE 8

    Hey guys,

    I am having trouble with validators in IE8. When a Text Item's validateOnChange property is true, IE8 places the cursor in front of the last entered character. For example, in the code snip below, the text item validates on change, and when it does so, it jumps the cursor to the beginning, so if I typed 2, it would validate and be incorrect, but instead of the cursor staying behind the character entered last, it jumps in front of it.

    Of course, this is an IE8 thing (have not test on newer versions), and it woks fine in all other browsers that we use (Chrome and Firefox).

    Code:
    tiPortNumber = new TextItem("portNumber", "Port");
                tiPortNumber.setValue("Auto-gen");
                tiPortNumber.setValidateOnChange(true);
                tiPortNumber.setValidators(new PortValidator());
                tiPortNumber.addClickHandler(new ClickHandler()
                {
                    @Override
                    public void onClick(ClickEvent event)
                    {
                        TextItem ti = (TextItem) event.getSource();
                        ti.setValue("");
                    }
                });
    
    
    
    private class PortValidator extends CustomValidator
        {
            @Override
            protected boolean condition (Object value)
            {
                boolean isValid = false;
                int min;
                int max;
    
                try
                {
                    min = Integer.valueOf(GSUI.getProperties().get("minStreamDestinationPort").toString());
                    max = Integer.valueOf(GSUI.getProperties().get("maxStreamDestinationPort").toString());
                }
                catch(Exception ex)
                {
                    min = 20000;
                    max = 29999;
                }
    
                //check the range
                try
                {
                    int val = Integer.valueOf(value.toString());
                    if(val <= max && val >= min)
                    {
                        isValid = true;
                    }
                    else
                    {
                        isValid = false;
                        this.setErrorMessage("Out of range " + min + "-" + max);
                    }
                }
                catch (NumberFormatException e)
                {
                    SC.logWarn(e.getStackTrace().toString());
                }
                return isValid;
            }
        }

    #2
    We have some logic in place which is supposed to prevent this from happening but it may be failing. We'll look into it and should be able to get it resolved in the next couple of days.

    Comment


      #3
      We've resolved this issue in the 3.1d branch. The change should show up in the next nightly build.

      Regards
      Isomorphic Software

      Comment


        #4
        That's good news. Is there a chance that this patch will be applied to a 3.0 branch? We currently do not use 3.1, as we have had problems changing over in the past.

        Thanks,

        Comment


          #5
          We've ported this fix across for you. Try the next nightly build
          Thanks
          Isomorphic Software

          Comment

          Working...
          X