Change function only passing first selection RRS feed

  • Question

  • Hello all.  I need a little guidance with this.

    I am trying to implement a dropdown that passes the selected item's ID to a Save button.  The ID parmeter is needed to show a custom view of a new item's data.  Here are the two snippets of code:

    This is the code for the Savebutton.  A relative url is being used as a placeholder

    <td style="grid-column-align: end;">
                                <a id="lnkSave" href="../SEB%20Product%20Planning1/AllItems.aspx" data-ajax="false" data-role="button">
                                    <img style="border: 0" src="http://ai-spsebdev5/SEBTracker/SiteAssets/Save.png" /></a>

    Here is the change function snippet:

     //Dropdown Change Event
            $("#ddlProductPlan").change(function () {
                $(a[href='../SEBTracker....?ID=']).attr('href', ".../SEBTracker...?ID=" + $(this).val().split(';')[0]));
                // Fetch the Product Plan Details 
                // Fetch the Resource Allocation for the chosen Product Plan

    The problem I am having is the first time an item is selected, the href is updated to that item.   If you change to a different item without saving,  the href still holds the value of the first selected item.   What am I doing wrong? I need the href to have the current selected item,  not stay with the first selected item.

    Thanks,  James


    James Pruitt

    • Edited by JP2011 Monday, September 15, 2014 7:42 PM To many code snippets
    Monday, September 15, 2014 7:41 PM