Skip to Content
author's profile photo Former Member
Former Member

Event onfocusout for ValueHelpField

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jan 01, 2014 at 05:38 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 01, 2014 at 05:40 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.