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

Dynamic Validate Problem #212

Open
gunaysirbudak opened this issue Jan 31, 2019 · 0 comments
Open

Dynamic Validate Problem #212

gunaysirbudak opened this issue Jan 31, 2019 · 0 comments

Comments

@gunaysirbudak
Copy link

Hi,

If the Create_user field is enabled, check the password and default_lang fields using the following code.

If Create_user is disabled, I'm canceling control of those fields.

However, when create_user becomes active and inactive, it always performs mandatory field control.

I'm waiting for your help and support.

`

    if(document.getElementById('user_create').checked == true)
    {
        $('#password').attr('required','required');
        $('#password').attr('data-validation-required-message','<?= lang('required_error'); ?>');
        $('#password').attr('minlength','6');
        $('#password').attr('data-validation-minlength-message','<?= lang('minlength_error'); ?>');
        $('#password').attr('aria-invalid','true');

        $('#default_lang').attr('required','required');
        $('#default_lang').attr('data-validation-required-message','<?= lang('required_error'); ?>');
        $('#default_lang').attr('aria-invalid','true');

        $("input,select,textarea").not("[type=submit]").jqBootstrapValidation();
        $('#user').removeAttr('style');

    }
    else
    {
        $("input,select,textarea").jqBootstrapValidation("destroy");
        $('#password').removeAttr('required');
        $('#password').removeAttr('data-validation-required-message');
        $('#password').removeAttr('minlength');
        $('#password').removeAttr('data-validation-minlength-message');
        $('#password').removeAttr('aria-invalid');


        $('#default_lang').removeAttr('required');
        $('#default_lang').removeAttr('data-validation-required-message');
        $('#default_lang').removeAttr('aria-invalid'); 

        $("input,select,textarea").not("[type=submit]").jqBootstrapValidation();

        $('#user').attr('style', 'display: none;');

    }`
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

1 participant