function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
FinnArildFinnArild 

Actionsupport cascading multiple fields

I have two select lists (Product, Version) and an output listing (files) which should work together so the user can select different products, versions and get the file downloads. Some code:

 

 

  <apex:pageBlock title="Select product and version for download" id="sel">
    <apex:form >
      <apex:outputLabel value="Product: " for="productsel"/>
      <apex:selectList size="1" value="{!selProd}" id="productsel">
        <apex:selectOptions value="{!products}"/>
        <apex:actionSupport event="onchange" rerender="availableversions"/>
      </apex:selectList>
      <apex:outputLabel value="Version: " for="availableversions"/> 
      <apex:selectList value="{!selVersion}" size="1" id="availableversions">
        <apex:actionSupport event="onchange" rerender="listing"/>
        <apex:selectOptions value="{!curVersions}"/>    
      </apex:selectList>
    </apex:form>
  </apex:pageBlock>
  <apex:pageBlock title="Files" id="listing">
    <!-- LISTING CODE --> 
  </apex:pageBlock>

Problem with this code, is that when I select product, the version listing is updated but the files listing is not - but I thought I knew how to fix that - I changed the first actionsupport to: 

 

        <apex:actionSupport event="onchange" rerender="availableversions,listing"/>

 You should think that would work, wouldn't you? But no - the listing is obviously rendered before the version change can write the correct version so I can get the correct listing.

 

 

I have tried several things - including setting up getter/setter methods that tries to counter this behavior - but even if I pick the correct version in the product setter method, it seems that this is being overridden by the wrong version again somehow.

 

Does anyone have any suggestion to what I might try - or maybe even a working example?