facebook

de-select list: CLOSED

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #336861 Reply

    Paul_paul
    Participant

    hi people
    re: : viewtopic.php?p=8932#p8932

    I get that this should work but I’m not quite understanding it, this is the code I am using to select items from ‘list1’

    phoneui.prePageTransition = function(currentPageId,targetPageId) {

    if (currentPageId == ‘#m1-tv_order’) {
    summarize();
    }

    return true;
    }

    phoneui.documentReadyHandler = function() {
    }

    function summarize() {
    var summary = “”;

    //multiple select list: get selected items as array
    $(‘select[name=”list1″] :selected’).each(
    function(i, selected) {
    summary += $(selected).text()/* + “;” + $(selected).val()*/ + “\n”;
    });

    $(‘#m1-summary-textArea1’).text(summary);
    }

    This all works great but I think I need to provide a button on the summary page clearing the selections in the textArea and all the ticks in the selectlistitem boxes.
    Then where do I put the code? Do I attach it to the button under ‘run javascript’ or does it go in the _custom.js file.
    Can you help with this please?

    Regards

    #336872

    Brandon
    Member

    You should be able to do either one. The button action run javascript will be wriiten to the file. However, if you may need to use it again I would suggest the custom js file, this allows you to call it from the button or if you need to call it anywhere else you can also.

    #336882

    Paul_paul
    Participant

    Thx Cincy,
    With that in mind I still need the code to make it work and where exactly would it go on the custom.js. I have no experience with JS and have to rely on the kindness of others.
    Regards

    #336883

    Brandon
    Member

    I believe you need something like this (untested):

    $('.m1-selection-list > li').each(function (i) {
      $(this).removeClass(m1Design.css("selected"));
    });
    phoneui.preprocessDOM();

    You can put that in the Run Javascript of a button or into a function and call that from the button:

    
    function clearList()
    {
    $('.m1-selection-list > li').each(function (i) {
      $(this).removeClass(m1Design.css("selected"));
    });
    phoneui.preprocessDOM();
    }
    

    then call the clearList() from the button

    #336894

    Paul_paul
    Participant

    That works, many thanks for your help.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: de-select list: CLOSED

You must be logged in to post in the forum log in