[SalesForce] How to i create dynamic filtering report with the user input

I need to get the pc0 and pn0 and pv0 from the user input fields

<apex:page>
<html>
    <script type="text/javascript">
       function changeText2(){
      var userInput0 = document.getElementById('userInput').value;
      var userInput11 = document.getElementById('userInput1').value;
      var userInput21 = document.getElementById('userInput2').value;
      //document.write("userinput");
      window.open("/00ON0000000FOHS?pc0="+userInput0+"&pn0="+userInput11+"&pv0="+userInput21, "_bla");
}
    </script>

    Here is a link : <a href="/00ON0000000FOHS?pc0=userInput0&pn0=userInput11&pv0=userInput21" id='test'>nothing here yet</a> <br/>
    <input type='text' id='userInput' value='Enter Search String Here' />
    <input type='text' id='userInput1' value='Enter Text Here' />
    <input type='text' id='userInput2' value='Enter Text Here' />
    <input type='button' onclick='changeText2()' value='Change Link'/>
</html>
</apex:page>

it is showing in the url https://cs6.salesforce.com/00ON0000000FOHS?pc0=name&pn0=ne&pv0=teja but it is not filtering in the report

can any body tell me that what pc0:it si field name or label or api
pn0 and pv0 toooo?

Best Answer

Your question seems odd to me, if you want to retrieve user input fields from a visualforce page, first you need to know what are the fields you need from it and then you can call those values from your apex methods, for example:

//this is the default value for this parameter
private String empresa = 'Global';

//this defines how to call the value
public String getEmpresa() {
   return empresa;
}
//setter method
public void setEmpresa(String empresa) { this.empresa = empresa; }

 //in the visualforce
 <td align="center" valign="top">
      <label><b>Empresa</b></label>
 </td>
 <apex:actionRegion >
<td align="left" valign="middle">   
   <apex:selectList value="{!Empresa}" multiselect="false" size="1">
                                                          <apex:selectOptions value="{!items}"/>
                                                          <apex:actionSupport event="onchange" rerender="paquetes,paquetesDetalle" status="cargando"/>

                                                          </apex:selectList><p/>
</td>
   </apex:actionRegion>

Of course there are other ways to get it done, but if this is not your case be more specific about what you need

Regards

Related Topic