Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
Surpress Enter Key on igNumericEditor
posted

I have implemented an igNumericEditor on my page.

When the users pressed the Enter Button the form closes.

How can I catch the Enter key to prevent my page to close.

(I have seen: https://ko.infragistics.com/community/forums/f/ignite-ui-for-javascript/67254/submitting-with-enter-key )

but this solution seems not to be working on igNumericEditor.

my implementation looks like

$("#number_working_hours").igNumericEditor( {
minValue: 100,
maxValue: 9000,
dataMode: 'int',
groupSeparator: String.fromCharCode(65279),
regional: 'de',
hideEnterKey: true,
keydown: function(evt, ui) { return false; // return ui.key !== 13;
}
});

Parents
No Data
Reply
  • 1320
    Verified Answer
    Offline posted

    Hello Karl-Heinz,

    After investigating this further, I determined that your request could be achieved in two ways, depending on when Enter should be suppressed. If pressing Enter anywhere on the page should disable submitting the form, the following lines of code could be used:

    $(document).ready(function(){

                $("#document").keydown(function(event){

                    if(event.keyCode == 13) {

                        event.preventDefault();

                        return false;

                    }

                });            

            });

    If pressing Enter only within the igNumericEditor should disable submitting the form, however,  pressing Enter in the other input fields not, the id of the input, bound to the igNumericEditor, should be set, instead of “#document”. I have prepared a sample, demonstrating the second way, this request could be achieved.

    Please let me know if you need additional information regarding this matter.

    Regards,

    Monika Kirkova,

    Infragistics

    igNumericEditor.rar

Children