Announcement

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

    FormItem changed event not firing on cvalue lear

    Hi all,

    I have a form whereby other fields are hidden/showed, enabled/disabled based on another field.

    The show hide is controlled by setShowIfCondition() method..

    Code:
                    effectedField.setShowIfCondition(new FormItemIfFunction() {
                        @Override
                        public boolean execute(FormItem item, Object o, DynamicForm dynamicForm) {
                            String dependantFieldValue = FormUtil.getStringValue(dependantField);
                            return isConditionMet(dependantFieldValue, definitionDto.getShowIfOperator(), definitionDto.getShowIfValue());
                        }
                    });
    The enable/disable is controlled via a changedEvent...

    Code:
                    dependantField.addChangedHandler(new ChangedHandler() {
                        @Override
                        public void onChanged(ChangedEvent changedEvent) {
                            String dependantFieldValue = FormUtil.getStringValue(dependantField);
                            effectedField.setDisabled(isConditionMet(dependantFieldValue, definitionDto.getDisableIfOperator(), definitionDto.getDisableIfValue()));
                        }
                    });
    This works fine most of the time, however where there are SelectItem fields, I have added a clear picker icon in order to clear the value...

    Code:
                        selectItem.setIcons(new PickerIcon(PickerIcon.CLEAR, new FormItemClickHandler() {
                            @Override
                            public void onFormItemClick(FormItemIconClickEvent formItemIconClickEvent) {
                                formItemIconClickEvent.getItem().clearValue();
                                
                            }
                        }));
    By calling clearValue(), the update event is not fired. Not sure if this is a bug, if so, maybe it's fixed in a newer version, but for now, is there a way in the method that is called by the clear icon to manually fire the field update event?

    Thanks,
    Dale

    Smart GWT Version : 4.0p
    Smart GWT Build Date : Mon Dec 23 10:04:00 GMT 2013
    GWT Version : 2.4.0
Working...
X