cancel
Showing results for 
Search instead for 
Did you mean: 

Event onfocusout for ValueHelpField

Former Member
0 Kudos

Hello,


I want to implement a logic whenever a ValueHelpField loses focus. So I tried with the following code:

              var oLayout = new sap.ui.commons.layout.MatrixLayout({layoutFixed :false});    

              oLayout.addRow(new sap.ui.commons.layout.MatrixLayoutRow({    

                 cells:[new sap.ui.commons.layout.MatrixLayoutCell({    

                                content: [new sap.ui.commons.Label({text :"Center: "})]

                        }),

                        new sap.ui.commons.layout.MatrixLayoutCell({

                                content:[new sap.ui.commons.ValueHelpField({ 

                                       value: "", 

                                       valueHelpRequest: function(){alert("TODO"); },

                                       change :      [function(oEvent) { alert("CHANGE EVENT");} ],

                                       onfocusout : [function(oEvent){ alert("onfocusout");} ] 

                            })]    

                   })    

            ]

            }));

         oLayout.placeAt("content");

    

But, only the change event is working fine, onfocusout is never called. How to make it work?

Please Help Me.

Thanks & Regards,

Shubham Dehariya

Accepted Solutions (1)

Accepted Solutions (1)

former_member184867
Active Contributor
0 Kudos

Hi Subham,

Here is the snippet


var oLayout = new sap.ui.commons.layout.MatrixLayout({layoutFixed :false});   

              oLayout.addRow(new sap.ui.commons.layout.MatrixLayoutRow({   

                 cells:[new sap.ui.commons.layout.MatrixLayoutCell({   

                                content: [new sap.ui.commons.Label({text :"Center: "})]

                        }),

                        new sap.ui.commons.layout.MatrixLayoutCell({

                                content:[new sap.ui.commons.ValueHelpField({

                                       value: "",

                                       valueHelpRequest: function(){alert("TODO"); },

                                       change :      [function(oEvent) { alert("CHANGE EVENT");}                              ],

                                      

                            }).attachBrowserEvent("mouseout", function() {console.log('Mouse out triggerred ' + new Date().toLocaleTimeString());})

                 

                                        ]   

                   })   

            ]

            }));

  

         oLayout.placeAt("content");

Regards,

Atanu

Former Member
0 Kudos

Thanks Atanu for the idea, instead of "mouseout" I am using "focusout" which is working perfectly.

Regards,
Shubham

former_member184867
Active Contributor
0 Kudos

cool

Answers (1)

Answers (1)

surendra_pamidi
Contributor
0 Kudos

Hi Shubham,

1.

change Event is fired when the text in the field has changed AND the focus leaves the TextField or the Enter key is pressed.

2.onfocusout(oEvent😞

Event handler called when control is losing the focus

I think both are same. So both events don't work at the same time.

Regards,

Surendra.