Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT addValueChangeHandler to RichTextBox is not allowed, an alternative way required

Tags:

java

gwt

I am trying to update the database once I have changed the RichTextBox and have exited the RichTextBox (i.e., I do not want to force the user to press an "Update button"). However, my code throws the exception The method addValueChangeHandler(new ValueChangeHandler<String>(){}) is undefined for the type RichTextArea on 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 of doing this please?

like image 417
Glyn Avatar asked Mar 13 '23 15:03

Glyn


1 Answers

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

Blur event gets fired when the component loses focus. For more info on blur event, please read this.

For info on GWT BlurEvent, read this.

like image 70
RAS Avatar answered Apr 13 '23 22:04

RAS