Skip to content

adding amd module loader - #1078

Open
vrkansagara wants to merge 2 commits into
proengsoft:masterfrom
vrkansagara:master
Open

adding amd module loader#1078
vrkansagara wants to merge 2 commits into
proengsoft:masterfrom
vrkansagara:master

Conversation

@vrkansagara

Copy link
Copy Markdown

Description

What does this achieve?

Is it necessary to merge into core or can it be overridden using existing features?

@vrkansagara

Copy link
Copy Markdown
Author

@bytestream Can you review this, as I already tried to test in amd module but this is not wokring for me

require(['jsvalidation'], function ($) { });

@vrkansagara

Copy link
Copy Markdown
Author

basically I treid to add into laravel way

<script>
    require(['jsvalidation'], function ($) {
        $("<?= $validator['selector']; ?>").each(function () {
            $(this).validate({
                errorElement: 'div',
                errorClass: 'invalid-feedback',

                errorPlacement: function (error, element) {
                    error.insertAfter(element);
                },
                highlight: function (element) {
                    $(element).removeClass('is-valid').addClass('is-invalid'); // add the Bootstrap error class to the control group
                },

                <?php if (isset($validator['ignore']) && is_string($validator['ignore'])): ?>

                ignore: "<?= $validator['ignore']; ?>",
                <?php endif; ?>


                unhighlight: function (element) {
                    $(element).removeClass('is-invalid').addClass('is-valid');
                },

                success: function (element) {
                    $(element).removeClass('is-invalid').addClass('is-valid'); // remove the Boostrap error class from the control group
                },

                focusInvalid: true,
                <?php if (Config::get('jsvalidation.focus_on_error')): ?>
                invalidHandler: function (form, validator) {

                    if (!validator.numberOfInvalids())
                        return;

                    $('html, body').animate({
                        scrollTop: $(validator.errorList[0].element).offset().top
                    }, <?= Config::get('jsvalidation.duration_animate') ?>);

                },
                <?php endif; ?>

                rules: <?= json_encode($validator['rules']); ?>
            });
        });
    });
</script>
`

@vrkansagara

Copy link
Copy Markdown
Author

I am facing this issues

image

@vrkansagara

Copy link
Copy Markdown
Author

@bytestream Would you like to guide or make correction if any here, this will be great help to fix AMD module loader

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

Successfully merging this pull request may close these issues.

1 participant