Skip to content

wrong value using Switch or TextField(!) in combination with updateOn: 'blur'  #1362

Open

Description

@gms1

The first toggle seems to get lost. After that the value is 'true' if the switch is off and 'false' if the switch is on

This is the repo to reproduce this issue:
https://github.com/gms1/issues/tree/master/nativescript_angular/switch-updateOnBlur

Activity

  1. self-assigned this
    on Jun 4, 2018
  2. tsonevn commented on Jun 4, 2018

    @tsonevn
    Contributor

    Hi @gms1,
    Thank you for the sample project.
    I tested this case while using the Switch component with '@angular/forms'. Indeed the valueChanges method will not be executed on first Switch value change. For further info, please keep track on the issue.

  3. gms1 commented on Jun 10, 2018

    @gms1
    Author

    Hi @tsonevn,

    regarding Switch and other controls, I wondered how an "updateOn: blur" could work, as long as there are no focus/blur events from the underlying framework for these controls.
    However, I am getting a similar behavior using Textfield, although focus/blur events are fully supported for this control.

    In the repo there is now a new folder 'testfield-updateOnBlur' with which the problem with TextField can be reproduced.

    Should I open a new issue for TextField?
    For Switch / Slider, ... this feature may not be that important, but with TextField we are now forced to unnecessarily validate all typos, or to implement a workaround every time that bypasses the standard validation

  4. changed the title [-]wrong value using Switch in combination with updateOn: 'blur' [/-] [+]wrong value using Switch or TextField(!) in combination with updateOn: 'blur' [/+] on Jun 11, 2018
  5. gms1 commented on Jun 11, 2018

    @gms1
    Author

    added TextField to the title

    however, it is possible that the TextField-issue already has a solution:
    #1230

    see ControlValueAccessor

      * On blur (or equivalent), your class should call the registered function to allow
       * the forms API to update itself:
       *
       * ```ts
       * host: {
       *    '(blur)': '_onTouched()'
       * }
       * ```
    
  6. gms1 commented on Jun 11, 2018

    @gms1
    Author

    verified: #1230 solves the TextField-part of this issue!

  7. removed their assignment
    on Jun 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions