I have the following code:
Code:
// search return dropdown
$('.ous').live('click', function() {
    // get ou value from vbs sub addou and add to results dropdown
    addou();
    // get current selection
    var resultou1 = $('.ous option:selected').val();
    // apply formatting for use in textarea
    var resultou = '""' + resultou1 + '""\n\r';
     // add to textarea for export to parent page
    $('#ouParent textarea').append(resultou);
    // remove current selection from dropdown
    $('.ous option:selected').remove();
});

// results dropdown
$('.newous').live('click', function() {
    // get current selection
    var selected = $('.newous option:selected').val();
    // remove selection from this dropdown and append back to search return dropdown
    $('.newous option:selected').remove().appendTo('.ous');
    // ****** start textarea removal *****//
    // get current data from textarea
    var getData = $('.oudata').val(); // may need to use text or valHooks instead of val (val strips carriage return characters)
    // apply formatting to match what is in the textarea
    var NewData = '""' + selected + '""\n';
    // find string in textarea and remove it
});
This is a form with 2 selects with the ability to move options from one select to the other, when added to the second select I format the selection and append it to a textarea for export to a parent page to be used for an application specific project.

Everything is working 100% but I am stuck on the following and need help:

  • Issue 1: When an option is removed from the second select I need to search the textarea and remove that specific string preserving the formatting of the other strings, it cannot have any blank lines.
  • Issue 2: I want to prevent duplicates to be moved from the first select to the second select. This can happen if an end user runs another search (vbscript) using the same criteria many times thus appending the same data. The form needs to allow many searches but with different criteria.



I have well documented my code so it is easier to follow. Any help is greatly appreciated!

Thanks,
Bob