facebook

Display selected list item in text area ( and un-select )

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #328715 Reply

    StephenNott
    Member

    Hi
    iPhone 4S
    I refer to my previous post in Examples – How to , “Display selected list item in text area”, re the above.
    My app has ( at least ) 2 “list” screens and a summary screen.
    Each “list” screen has 3 list items and i need just one selection from this list to be displayed on the summary screen at any one time.
    The code I used ( basically from yr example and detailed in my previous post ) works fine and clears the textArea1 of the selected item when returning
    to the list screen(s) when performed in the emulator…… but not when built & downloaded to my 4S, it PERSISTS in showing
    2 selections in the textArea1.
    I get same result in chrome browser.
    I have tried various other methods ( see below for just one of them ).
    Can u give a definitive code for achieving what i require.
    ///////////////////////////
    /**
    * Notification that the UI is about to transition to a new page.
    * Perform custom prepage-transition logic here.
    * @param {String} currentPageId
    * @param {String} targetPageId
    * @returns {boolean} true to continue transtion; false to halt transition
    */
    phoneui.prePageTransition = function(currentPageId,targetPageId) {
    // add custom pre-transition code here
    // return false to terminate transition

    if (targetPageId == ‘#m1-summary’) {
    summarize();
    refresh();
    }

    return true;
    }

    /**
    * Notification that the UI has transition to a new page.
    *
    * @param {String} newPageId
    */
    phoneui.postPageTransition = function(newPageId) {

    }

    /**
    * Notification that device orientation has changed.
    *
    * @param {String} newOrientation
    */
    phoneui.postOrientationChange = function(newOrientation) {

    }

    /**
    * Called when document is loaded.
    */
    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);

    }
    // Remove selections

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

    });

    phoneui.preprocessDOM();

    }
    /////////////////////////////////
    Thks

Viewing 1 post (of 1 total)
Reply To: Display selected list item in text area ( and un-select )

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