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
Simon WhightSimon Whight 

Using Javascript to determine what an Apex Repeat displays

I'm trying to avoid using a controller and extension to make a Visualforce template.

What I'd like to do is use some JavaScript to determine what the Apex Repeat displays, ideally only returning the fields for the Contract object the button that will run the email is located in (The relatedtotype is pointing at Account and I can't get around that).

Is this at all possible?

I've been fumbling around but I am in no way Javascript proficient. Can't even get a whole load of results to display, let alone refine by a Contract Name or similar.

This is what I've been doing 
<!--Table 8 **************************************************************************************-->
         
         <table border="0" width="1200px" >
           <col width="1200"/>
           <caption>Deal Overview</caption>
           <tr>
            <th>Contract Term (months)</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <tr>
   <td>       
  <script type="text/javascript">
      var contract = [];
            <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">        
            Contract.push(ContractTerm : "{!ctrtx.ContractTerm}",
            ContractNumber : "{!ctrtx.ContractNumber}")
            </apex:repeat> 

      contract.ContractTerm;      
    </script></td>
          </tr>
        </table>

I'd hope to whittle down the ContractTerm to the particular one of the contract record where my button is located.