1

Despite trying to make it work at all posible ways, i'm not able to order the select/options form from A to Z. it displays me by option "id" and what i want is to show my drupalgap form using hook_form_alter and display the order correctly. This is the last thing i tried until now. Thanks!!!

 $(document).on("pageload", "#informes", function() {
      console.log("hola");
        $("#edit-views-exposed-form-field-organismo-auditado-mobile-value").append($("#edit-views-exposed-form-field-organismo-auditado-mobile-value option").remove().sort(function(a, b) {
            var at = $(a).text(), bt = $(b).text();
            return (at > bt)?1:((at < bt)?-1:0);
        }));
      });
4
  • Do a console.log(form.elements['field_organismo_auditado_mobile_value']);, what does that report? Please use pastebin (or something). May 18, 2015 at 19:25
  • I did it so what i have to apply is a function... like the one i edited in the topic. The problem is that the console.log works but not the function. When i put the function into the console it works!!! i don't know how to make it work when the page load!!!
    – HomerO
    May 19, 2015 at 18:28
  • Maybe try the 'pageshow' event and make sure you're including your JS like this: drupalgap.org/node/531 May 26, 2015 at 13:46
  • I implemented everything the drupalgap site said, like the script in the html and the pageshow event. But anything seems to work, i have now a clean code but it's necessary that the arguments of the hook form alter pass the parameters to the other function. To know what i mean i will post the code in fiddle. jsfiddle.net/1wd9zegg
    – HomerO
    May 26, 2015 at 22:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.