Skip to Content
avatar image
Former Member

how to end change event triggered of input field?

Hi All,

I have input field in a view 2 and validation for the same has been written in the change event.So lets say user inputs some wrong input and then without clicking enter or leaving focus he click another button to move to view 1.so now the view 1 is displayed and popup for the validation is also is displayed which is odd.

so how to stop or end any kind of process happening in view 2 and then proceed to view 1 ? in this case the change event functionality.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Jul 07, 2015 at 09:37 AM

    I believe the user should not go to view 1 in the first place; if he entered something wrong, then the navigation should be cancelled and the validation popup should be shown.

    Why do you want to allow users to navigate away from the screen if they entered invalid input?

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 07, 2015 at 07:25 AM

    Use detachChange event before processing that view.

    JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.m.InputBase

    On press event of that button through which you are navigating to another view, get the ID of that input field and after that write this.

    oInput.detachChange();

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 07, 2015 at 07:27 AM

    call validation method. and the validation is fine then do navigation.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 07, 2015 at 07:37 AM

    Hi Thivi,

    There is a property "valueLiveUpdate" for sap.m.Input.


    Definition - Indicates when the value gets updated with the user changes: At each keystroke (true) or first when the user presses enter or tabs out (false).


    Try to user it


    Hope this will help.


    Regards,

    Abhijeet

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 07, 2015 at 04:35 PM

    there is a clearlly issue with navigation condition, it should not happen if validation fails

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 07, 2015 at 04:44 PM

    @ robin @ santhosh @maksim Thats is the right way to validate  but the end user is not ok with it.His point of view its like in view 2 he entered some value by mistake and now he wants to move to view 1 but he sees the "no data found" popup in view 1 which is strange for him.

    I tired the detachchange too its not working ..

    is there any other solution possible for this

    Add comment
    10|10000 characters needed characters exceeded

    • If he want's it like that, then there should be a 'reset' button or something, changing everything back to the original state.

      Navigating to another view without validating wrong input is just plain wrong. It might maybe help this particular user, but other users will be confused as to why their data is not being saved when navigating to another view