Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/app/design/frontend/Cnc/default/Magento_Theme/web/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/app/design/frontend/Cnc/default/Magento_Theme/web/js/field-validation.js
/**
 * @license http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 * @author Romain Cuillerier <[email protected]>
 * @copyright Copyright (c) 2020 Kaliop Digital Commerce (https://digitalcommerce.kaliop.com/)
 */
define([
    "jquery",
    "tools"
], function ($) {
    "use strict";

    $(function () {
        var identicalFieldValidation = {
            /**
             * Constructor
             */
            init: function(){
                this.checkElement();
            },

            /**
             * Check if confirmation element exist and detection of the change in value of the element
             */
            checkElement: function() {
                var el = this,
                    inputConfirmation = $('.field + .confirmation .input-text');

                if(inputConfirmation.length) {
                    inputConfirmation.each(function () {

                        /** Trigger function after changing the value of the confirmation field */
                        $(this).on('change', function() {
                            el.checkElementValue($(this));
                        });

                        /** Trigger function after changing the value of the first field */
                        $(this).parents('.field.confirmation').prev().find('.input-text').on('change', function() {
                            el.checkElementValue($(this).parents('.field').next().find('.input-text'));
                        });
                    })
                }
            },

            /**
             * Get confirmation element value and compare with first element
             */
            checkElementValue: function(el) {
                var inputCompare = el.parents('.field.confirmation').prev().find('.input-text').val();

                if(el.val() == inputCompare) {
                    el.parent().addClass('is-valid');
                } else {
                    el.parent().removeClass('is-valid');
                }
            },
        };

        identicalFieldValidation.init();
    });
});

Spamworldpro Mini