GWT addValueChangeHandler is not allowed for RichTextBox, alternative method required

I try to update the database as soon as I change RichTextBoxand exit RichTextBox(i.e. I do not want to force the user to click the "Update" button). However, my code throws an exception The method addValueChangeHandler(new ValueChangeHandler<String>(){}) is undefined for the type RichTextAreain the first line.

                             textBoxExistingDescription.addValueChangeHandler(new ValueChangeHandler<String>() {
                                public void onValueChange(ValueChangeEvent<String> event) {

                                    //If a record for this Youth Member specific detail line exists then update it else add it.
                                    if (ymAwardDetails.getYmsdId() != null) {
                                        AsyncCallback<Void> callback = new YMSpecificHandler<Void>(ScoutAwardView.this);
                                        rpc.updateYMSpecific(ymAwardDetails.getYmsdId(), ymAwardDetails.getYmsdDetail(), callback);
                                    }else{
                                        AsyncCallback<Void> callback = new YMSpecificHandler<Void>(ScoutAwardView.this);
                                        rpc.addYMSpecific(youthMemberID, ymAwardDetails.getAdId(), ymAwardDetails.getYmsdDetail(), callback);
                                    }
                                }
                            });

Is there an alternative way to do this, please?

+4
source share
2 answers

Looking at your requirement, I think the same thing that you can also achieve by implementing addBlurHandler()instead addValueChangeHandler().

The Blur event is fired when the component loses focus. For more information on the blur event, please read.

GWT BlurEvent, .

+5

-, ValueChangeHandler ( ) , , 1 , ,

, , , , , .

:

  • RichTextArea:

    MyRichTextArea RichTextArea HasValueChangeHandlers {

        @Override
        public HandlerRegistration addValueChangeHandler(ValueChangeHandler<String> handler) {
            return this.addHandler(handler, ValueChangeEvent.getType());
        }
    
    }
    
  • .

  • RichTextBox keyDown:

- 3 , .

3- - , .

+2

Source: https://habr.com/ru/post/1623861/