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

Scrolling to required field form validation #317

Open
kiddynomite opened this issue Nov 11, 2020 · 0 comments
Open

Scrolling to required field form validation #317

kiddynomite opened this issue Nov 11, 2020 · 0 comments

Comments

@kiddynomite
Copy link

kiddynomite commented Nov 11, 2020

Hello,

I'm having an issue with scrolling to an input.error or select.error when trying to change steps. It wants to jump to the error class / tab button on the current step instead (class="current error"). I've tried setting autoFocus to false and supressPaginationOnFocus to true with no luck. Is there a simple way to ? In the onStepChanging method I'm simply trying to scroll to the closest error:

if (form.valid())
                        return true;
                    else {
                        var errors = $('select.error, input.error')
                        if (errors.length) {
                            setTimeout(function () {
                                if (form.closest('.modal-body').length) {
                                    form.closest('.modal-body').off('scroll');
                                    form.closest('.modal-body').animate({ scrollTop: errors.eq(0).offset().top - form.closest('.bootstrap-dialog-message').offset().top - 30}, 500);
                                } else {
                                    $('body').animate({ scrollTop: errors.eq(0).offset().top }, 'fast')
                                }
                            }, 100);
                        }
                        return false;

Thanks for any insight.

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