Workflow Soluiton

 View Only
  • 1.  Clear selected listboxcomponent on refresh

    Posted Aug 08, 2011 04:44 PM

    Is there a way to clear the selected listboxcomponent in between page refreshes? I am using a dynamic update panel with a refresh button. When I select something from the listboxcomponent and then change my search criteria so that the listboxcomponent array has less values than the selected index it throws the following error:

    "Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index"

    Here is an example to make this more clear: I am searching for AD users, the input is a text box where a last name is entered and the search is lastname*.

    Search1:back
    This only returns 2 values, I dont select any.

    Search2: ba
    I select the 8th user in the listboxcomponent

    Search3: back
    I receive an application error.



  • 2.  RE: Clear selected listboxcomponent on refresh

    Posted Aug 11, 2011 01:31 PM
    depending on how you're populating the list box, you can use the "initialize data" component in front of a dynamic model to clear the list box variables each time the box loads. i usually put it right after the start component and declare all my variables there. just use a blank or empty value for the variables when you initialize them. so lets assume you're populating the list box with constant values. take those values and initialize them as a text array (for example) in a dynamic model instead. also in the initialize data component, add a blank value for the listbox's OUTPUT value as well. this will force the selected item to be cleared on list load. hope that helps you friend!


  • 3.  RE: Clear selected listboxcomponent on refresh

    Posted Aug 11, 2011 05:10 PM

    Africo,

    I am not sure I completely understand what you are saying. Right now I am setting the values in the listbox in a dynamic model.

    Here is what I am using: http://www.screencast.com/t/q83d3a2HLnB

    Thanks!
    Dustin



  • 4.  RE: Clear selected listboxcomponent on refresh
    Best Answer

    Posted Aug 11, 2011 06:47 PM
      |   view attached

    i decided the easiest way to do this is to just put a javascript action in the Refresh button.  see if that'll work for you.

    set the Control ID on the listbox to something like "listBoxTest", as below

    add a custom event to the Refresh button - 
    onclick
    listBoxTest.selectedIndex = -1;

    i've added an example package to this reply.

    Attachment(s)

    zip
    TestProjectDustG.zip   977 KB 1 version


  • 5.  RE: Clear selected listboxcomponent on refresh

    Posted Aug 15, 2011 11:42 AM

    Thank you for the detailed steps. The solution worked perfectly!



  • 6.  RE: Clear selected listboxcomponent on refresh

    Posted Aug 26, 2011 09:28 AM

    Dustin,

    I'll put together a workflow demo package for you to show you what i mean.