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).
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; } }
Comment