facebook

Example – display selected list items in textarea

  1. MobiOne Archive
  2.  > 
  3. Examples, HOW-TOs
Viewing 2 posts - 16 through 17 (of 17 total)
  • Author
    Posts
  • #328448 Reply

    StephenNott
    Member

    hi Octavio,
    IPhone4S / Mobi3.02
    “Example: Display SelectList selections in a TextArea”
    I need something slightly different to “stickleback”.
    In my app I have several screens ( eg MyList1.mobi, MyList2.mobi, MyList3.mobi ) , each screen with a 3 selectlist items ( single select ) and a “summary” screen ( with a textArea1 ) which shows the selection made.
    The Back button on this summary screen is set to ” Go Back”.
    This works fine for the first screen/selection ( say MyList1.mobi )but later on in the app i navigate to another of the MyList screens, ( say MyList2.mobi ) make selection and navigate to the “summary” screen…..which now still shows the first
    selection ( which i dont want to show ) as well as the latest selection. ie first selection has not been cleared from the “summary” textArea1.
    I have tried various methods to try to clear textArea1. It seems coding to
    over-write the selection in the <div class=”m1-aux-hidden-div”> is required, which i’ve tried but my java knowledge nor so good.
    Hope u can help on this.

    #328481 Reply

    StephenNott
    Member

    Hi Octavio,
    Found my answer in “Help with toggle buttons – set and re-set”….!!!!!!!
    Perhaps u should put a link to this topic
    To help others with same problem ……My “summarise” function now is:

    function summarize() {
    var summary = “”;

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

    //update text-area content
    $(‘#m1-summary-textArea1’).text(summary);
    ////////////////////////////////////////////////////////////////////////////////////
    // unselect all list items

    $(‘.m1-selection-list > li’).each(function (i) {
    $(this).removeClass(m1Design.css(“selected”));
    });
    phoneui.preprocessDOM();
    ///////////////////////////////////////////////////////////////////////////////////////
    }​

    This works fine for me

Viewing 2 posts - 16 through 17 (of 17 total)
Reply To: Example – display selected list items in textarea

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