Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue Login Form "remember" checkbox state ignored #356

Closed
sourcecodes2 opened this issue Oct 30, 2017 · 4 comments
Closed

Vue Login Form "remember" checkbox state ignored #356

sourcecodes2 opened this issue Oct 30, 2017 · 4 comments

Comments

@sourcecodes2
Copy link

Checking the form.remember checkbox on the login page (LoginForm.vue) does nothing.

The AJAX request always sends remember: "", even when checked.

My environment: MacOS Sierra, Chrome 61.

@ph4r05
Copy link

ph4r05 commented Nov 9, 2017

I am having the same issue. Click event does not get to the checkbox, v-model does not change on click.
Update: iCheck ( https://github.com/fronteed/icheck ) callback is not triggered.

@ph4r05
Copy link

ph4r05 commented Nov 9, 2017

I figured out the problem, the time of icheck initialization matters. I assume the icheck is initialized before it should be. If you wrap initialization in setTimeout(fnc, 1000) is starts working.

My dirty workaround:

  1. I've wrapped initialization in mount to the nextTick() in LoginForm.vue:
    mounted () {
        this.$nextTick(() => {
            this.initialitzeICheck('remember');
        });
    },
  1. InitializeIcheck.js - wrap to document ready, set timeout.
export default {
  methods: {
    initialitzeICheck (field) {
        const component = this;
        const compObj = $('input[name=' + field + ']');

        $(document).ready(() => {
            setTimeout(() => {
                compObj.iCheck({
                    checkboxClass: 'icheckbox_square-blue',
                    radioClass: 'iradio_square-blue',
                    increaseArea: '20%'
                });
            }, 10);

            setTimeout(() => {
                compObj.on('ifChecked', function (event) {
                    component.form.setField(field, true);
                    component.form.errors.clear(field);
                });

                compObj.on('ifUnchecked', function (event) {
                    component.form.setField(field, '');
                });

            }, 10);

        });
    }
  }
}

@acacha
Copy link
Collaborator

acacha commented Mar 14, 2018

Thanks @ph4r05 for the report and for possible solution. There are other issues related with icheck (#363) so I think that instead of solving this issue I will reimplement the Login component without icheck.

@acacha acacha closed this as completed Mar 14, 2018
@ph4r05
Copy link

ph4r05 commented Mar 14, 2018

@acacha thanks I did the same. I used vue-toggle component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants