#1
  1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,688
    Rep Power
    171

    OnChange="this.form.submit()" not working


    Hello;

    I use onChange="this.form.submit()" to submit forms and it always works fine. Recently I found a design that I like but I can't get onchange event to work on it. It is here, the drop down on the right column saying ORDER BY.

    Can anyone help please?

    THANKS
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    well, obviously the user interaction is not done on the native select element, but on the custom dropdown stuff. If you look into the source code (jquery.dropkick-1.0.0.js), you'll see that the current selection is handed down to the actual element via $select.val(value); (line 264). This does not trigger the "change" element.

    But if you look a few lines further down or read the documentation (http://jamielottering.github.io/DropKick/, "Custom 'change' callback"), you see that you need to pass your callback to the initial dropkick() call:

    Code:
    $('.change').dropkick({
      change: function (value, label) {
        alert('You picked: ' + label + ':' + value);
      }
    });
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  4. #3
  5. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,688
    Rep Power
    171
    Originally Posted by Jacques1
    Hi,

    well, obviously the user interaction is not done on the native select element, but on the custom dropdown stuff. If you look into the source code (jquery.dropkick-1.0.0.js), you'll see that the current selection is handed down to the actual element via $select.val(value); (line 264). This does not trigger the "change" element.

    But if you look a few lines further down or read the documentation (http://jamielottering.github.io/DropKick/, "Custom 'change' callback"), you see that you need to pass your callback to the initial dropkick() call:

    Code:
    $('.change').dropkick({
      change: function (value, label) {
        alert('You picked: ' + label + ':' + value);
      }
    });
    Excellent, thanks.

IMN logo majestic logo threadwatch logo seochat tools logo