File: src/plugin/components/filter/assets/filter.js

Recommend this page to a friend!
  Classes of Ar Gabid  >  Universal PHP Data Grid  >  src/plugin/components/filter/assets/filter.js  >  Download  
File: src/plugin/components/filter/assets/filter.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Universal PHP Data Grid
Display and process data to edit database records
Author: By
Last change: Update of src/plugin/components/filter/assets/filter.js
Date: 7 months ago
Size: 866 bytes
 

Contents

Download
function gdFilterSubmit(formId, href) {

    var parser = document.createElement('a');

    parser.href = href;

    var params = new URLSearchParams(parser.search);

    var form = document.getElementById(formId);

    var input = form.getElementsByTagName('input');

    var select = form.getElementsByTagName('select');

    var textarea = form.getElementsByTagName('textarea');

    var elements = Array.prototype.concat.call(input, select, textarea);

    for (var i = 0; i < elements.length; ++i)
    {
        for (var ii = 0; ii < elements[i].length; ++ii)
        {
            var value = elements[i][ii].value;

            var name = elements[i][ii].name;

            if (value === '' || name === '')

                continue;

            params.set(name, value);
        }
    }

    window.location.href = parser.pathname + '?' + params.toString()
}

For more information send a message to info at phpclasses dot org.