+ Start a Discussion
Andrea SloanAndrea Sloan 

Passing a VisualForce Filter from a Form to a Report Updated

I continue to have the problem that my VisualForce page Form does not pass onto my report's P2 filter the onchange="getComboA value selected on the form. The form passes on my calendar dates for P0 and P1 so this issue is specific to the GetCombo values not passing through correctly. Can someone please help me and suggest how I can tweak the Get Combo settings so this could pass through correctly?

   <apex:Page >
    <head>
        <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
        <script src="//code.jquery.com/jquery-1.10.2.js"></script>
        <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
        <link rel="stylesheet" href="/resources/demos/style.css"/>
        <script>
            $(function() {
                $("#pv2").datepicker({changeMonth: true, changeYear: true});
                 $("#pv12").datepicker({changeMonth: true, changeYear: true});          
                $(".datepick").datepicker({changeMonth: true, changeYear: true, constrainInput: false});      
              });             
        </script>       
       <script>
           function getComboA(sel,inputId) {
                document.getElementById(inputId).value = sel.value;
            }
       </script>
    </head>
<TD>
                <form method="get" action="/00OE0000002ujMC" >           
                <B>New Confirmed/Travels (This Month)</B>
                <BR/>
                <b>Date Ranges:</b>
               <br/>
               Travel Date From (MM/DD/YYYY):
                <input type="text" name="pv0" id="pv0" class="datepick" /> <br/>
                Travel Date To (MM/DD/YYYY):
                <input type="text" name="pv1" id="pv1" class="datepick" />
                <br />
                Confirm Date (MM/DD/YYYY):
                <onchange="getComboA(pv2,'pv3')"/>
                
                <select name ="pv2" id="pv3" onchange="getComboA(pv2,'pv3')">
                    <option value="This Month">This Month</option>
                    <option value="Last Month">Last Month</option>
                    <option value="This Year">This Year</option>
                    <option value="Last Year">Last Year</option>
                    <option value="Today">Today</option>
                    <option value="Yesterday">Yesterday</option>
                    <option value="This Quarter">This Quarter</option>
                    <option value="Last Quarter">Last Quarter</option>
                     <option value="   ">Blank </option>
                </select><br/>
                <input type="submit" value="My Confirmed Travels" class="submit" />
                </form>
            </TD>


 
Naval Sharma4Naval Sharma4
Hi Andrea,

Is this your full code?
Andrea SloanAndrea Sloan
Ni Naval:

No, it's not the full code. it's only the part relevant to the issue. My forms has multiple cells so I'm only focusing on the first one for now until it works. The system wouldn't let me post so many characters in my message but if you need the entire code I can send it to you if you provide me an email address.
Pramodh KumarPramodh Kumar
Hey Andrea,

Try use this code.

Try to use debugger for javascript errors
 
<apex:Page >
    <head>
        <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
        <script src="//code.jquery.com/jquery-1.10.2.js"></script>
        <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
        <link rel="stylesheet" href="/resources/demos/style.css"/>
        <script>
            $(function() {
                $("#pv2").datepicker({changeMonth: true, changeYear: true});
                 $("#pv12").datepicker({changeMonth: true, changeYear: true});          
                $(".datepick").datepicker({changeMonth: true, changeYear: true, constrainInput: false});      
              });             
        </script>       
       <script>
           function getComboA(sel,inputId) {
           var x = document.getElementById("pv3").value;
           document.getElementById("demo").innerHTML = "You selected: " + x;
            }
       </script>
    </head>
<TD>
                <form method="get" action="/00OE0000002ujMC" >           
                <B>New Confirmed/Travels (This Month)</B>
                <BR/>
                <b>Date Ranges:</b>
               <br/>
               Travel Date From (MM/DD/YYYY):
                <input type="text" name="pv0" id="pv0" class="datepick" /> <br/>
                Travel Date To (MM/DD/YYYY):
                <input type="text" name="pv1" id="pv1" class="datepick" />
                <br />
                Confirm Date (MM/DD/YYYY):
                <onchange="getComboA(pv2,'pv3')"/>
                
                <select name ="pv2" id="pv3" onchange="getComboA()">
                    <option value="This Month">This Month</option>
                    <option value="Last Month">Last Month</option>
                    <option value="This Year">This Year</option>
                    <option value="Last Year">Last Year</option>
                    <option value="Today">Today</option>
                    <option value="Yesterday">Yesterday</option>
                    <option value="This Quarter">This Quarter</option>
                    <option value="Last Quarter">Last Quarter</option>
                     <option value="   ">Blank </option>
                </select><br/>
                <p id="demo"></p>
                <input type="submit" value="My Confirmed Travels" class="submit" />
                </form>
            </TD>
            </apex:page>

Thanks
pRAMODH.
Andrea SloanAndrea Sloan
Hi Pramodh:

Thank you for this. I've just pasted this code and tried it but it doesn't work. My combo boxx sselection is not entering inside the report's Pv2 filter. Not only that, but now the calendar picker entries I neter for PV0 and PV1 are no longer entering the report which they were prior to this. Can you see if you could figure out the isue? thanks!

 
Pramodh KumarPramodh Kumar
I dont know what you are tryind to do, Could you explain your scenario in more detail and keep all your code. Without seeing the code no one can tell the issue here.


Thanks,
pRAMODH.
Pramodh KumarPramodh Kumar
<apex:Page >
    <head>
        <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
        <script src="//code.jquery.com/jquery-1.10.2.js"></script>
        <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
        <link rel="stylesheet" href="/resources/demos/style.css"/>
        <script>
            $(function() {
                $("#pv2").datepicker({changeMonth: true, changeYear: true});
                 $("#pv12").datepicker({changeMonth: true, changeYear: true});          
                $(".datepick").datepicker({changeMonth: true, changeYear: true, constrainInput: false});      
              });             
        </script>       
       <script>
           function getComboA() {
           var x = document.getElementById("pv3").value;
           document.getElementById("demo").innerHTML = "You selected: " + x;
            }
       </script>
    </head>
<TD>
                <form method="get" action="/00OE0000002ujMC" >           
                <B>New Confirmed/Travels (This Month)</B>
                <BR/>
                <b>Date Ranges:</b>
               <br/>
               Travel Date From (MM/DD/YYYY):
                <input type="text" name="pv0" id="pv0" class="datepick" /> <br/>
                Travel Date To (MM/DD/YYYY):
                <input type="text" name="pv1" id="pv1" class="datepick" />
                <br />
                Confirm Date (MM/DD/YYYY):
                <onchange="getComboA(pv2,'pv3')"/>
                
                <select name ="pv2" id="pv3" onchange="getComboA()">
                    <option value="This Month">This Month</option>
                    <option value="Last Month">Last Month</option>
                    <option value="This Year">This Year</option>
                    <option value="Last Year">Last Year</option>
                    <option value="Today">Today</option>
                    <option value="Yesterday">Yesterday</option>
                    <option value="This Quarter">This Quarter</option>
                    <option value="Last Quarter">Last Quarter</option>
                     <option value="   ">Blank </option>
                </select><br/>
                <p id="demo"></p>
                <input type="submit" value="My Confirmed Travels" class="submit" />
                </form>
            </TD>
            </apex:page>

 
Andrea SloanAndrea Sloan
Hi Pramodh:

Below is my entire code

<apex:Page >
   <head>
        <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
        <script src="//code.jquery.com/jquery-1.10.2.js"></script>
        <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
        <link rel="stylesheet" href="/resources/demos/style.css"/>
        <script>
            $(function() {
                $("#pv2").datepicker({changeMonth: true, changeYear: true});
                 $("#pv12").datepicker({changeMonth: true, changeYear: true});          
                $(".datepick").datepicker({changeMonth: true, changeYear: true, constrainInput: false});      
              });             
        </script>       
       <script>
           function getComboA() {
           var x = document.getElementById("pv3").value;
           document.getElementById("demo").innerHTML = "You selected: " + x;
            }
       </script>
    </head>

    Hello  {! $User.FirstName}
    <br/>
    <B>Use the date fields below to view Travel Dates for a specific time period</B>
    <TABLE Border= "3" CELLSPACING="1" CELLPADDING="1" columnClasses="red,green,blue">
        <br/>
        <CAPTION><B> Salesforce Reports </B></CAPTION>
        <br/>
        <TR>
            <TD ALIGN = "Center">
                <B>Opportunity Reports</B>
            </TD>
            <TD ALIGN = "Center">
                <B> Visit Summary Reports</B>
            </TD>
        </TR>
        <TR>
           <TD>
                <form method="get" action="/00OE0000002ujMC" >           
                <B>New Confirmed/Travels (This Month)</B>
                <BR/>
                <b>Date Ranges:</b>
               <br/>
               Travel Date From (MM/DD/YYYY):
                <input type="text" name="pv0" id="pv0" class="datepick" /> <br/>
                Travel Date To (MM/DD/YYYY):
                <input type="text" name="pv1" id="pv1" class="datepick" />
                <br />
                Confirm Date (MM/DD/YYYY):
                <onchange="getComboA(pv2,'pv3')"/>
                
                <select name ="pv2" id="pv3" onchange="getComboA()">
                    <option value="This Month">This Month</option>
                    <option value="Last Month">Last Month</option>
                    <option value="This Year">This Year</option>
                    <option value="Last Year">Last Year</option>
                    <option value="Today">Today</option>
                    <option value="Yesterday">Yesterday</option>
                    <option value="This Quarter">This Quarter</option>
                    <option value="Last Quarter">Last Quarter</option>
                     <option value="   ">Blank </option>
                </select><br/>
                <p id="demo"></p>
                <input type="submit" value="My Confirmed Travels" class="submit" />
                </form>
            </TD>
           

            <TD>
                 <form method="get" action="/00OE0000002us1h" >
                    <B>C- New Visits</B>
                    <br/>
                    <B>Date Ranges:</B>
                    <br/>
                    Travel Date From (MM/DD/YYYY):
                    <input type="text" name="pv0" id="pv4" class="datepick" /><br />
                    Travel Date To (MM/DD/YYYY):
                    <input type="text" name="pv1" id="pv5" class="datepick" />
                    <br />
                    <input type="submit" value="My Visits" class="submit" />
                </form>
            </TD>
        </TR>
            
        <TR>
            <TD>
                <form method="get" action="/00OE0000002uD4A" >           
                <B>A- Account Yearly Revenue (by Bus Unit)</B>
                <BR/>
                <b>Date Ranges:</b>
                <br/>
                Travel Date From (MM/DD/YYYY):
                <input type="text" name="pv0" id="pv6" class="datepick" /> <br/>
                Travel Date To (MM/DD/YYYY):
                <input type="text" name="pv1" id="pv7" class="datepick" />
                <br />
                <input type="submit" value="Account Yearly Revenue" class="submit" />
                </form>
            </TD>
            <TD>
                <form method="get" action="/00OE0000002uHmV" >
                    <B>C- Conversion Rate by Source</B>
                    <br/>
                    <B>Date Ranges:</B>
                    <br/>
                    Travel Date From (MM/DD/YYYY):
                    <input type="text" name="pv0" id="pv8" class="datepick"/><br />
                    Travel Date To (MM/DD/YYYY):
                    <input type="text" name="pv1" id="pv9" class="datepick"/>
                    <br />
                    <input type="submit" value="Conversion Rate" class="submit" />
                </form>
            </TD>
        </TR>
        
         <TR>
            <TD>
                <form method="get" action="/00OE0000002ujMC" >           
                <B>New Confirmed/Travels (This Month)</B>
                <BR/>
                <b>Date Ranges:</b>
               <br/>
                Travel Date From (MM/DD/YYYY):
                <input type="text" name="pv0" id="pv10" class="datepick" /> <br/>
                Travel Date To (MM/DD/YYYY):
                <input type="text" name="pv1" id="pv11" class="datepick" />
                <br />
                Confirm Date (MM/DD/YYYY):
                <input type="text" name="pv2" id="pv12"  style="width: 90px;" onchange="getComboA(this,'pv13')"/>
                
                <select name ="pv2" id="pv13" onchange="getComboA(this,'pv12')">
                    <option value="This Month">This Month</option>
                    <option value="Last Month">Last Month</option>
                    <option value="This Year">This Year</option>
                    <option value="Last Year">Last Year</option>
                    <option value="Today">Today</option>
                    <option value="Yesterday">Yesterday</option>
                    <option value="This Quarter">This Quarter</option>
                    <option value="Last Quarter">Last Quarter</option>
                </select><br/>
                
                <input type="submit" value="My Confirmed Travels" class="submit" />
                </form>
            </TD>
            <TD>
                 <form method="get" action="/00OE0000002us1h" >
                    <B>C- New Visits</B>
                    <br/>
                    <B>Date Ranges:</B>
                    <br/>
                    Travel Date From (MM/DD/YYYY):
                    <input type="text" name="pv0" id="pv13" class="datepick" /><br />
                    Travel Date To (MM/DD/YYYY):
                    <input type="text" name="pv1" id="pv14" class="datepick" />
                    <br />
                    <input type="submit" value="My Visits" class="submit" />
                </form>
            </TD>
        </TR>
    </TABLE>
</apex:Page>
Andrea SloanAndrea Sloan
Hi Pramodh:

As you could see from my entire code I posted in the previous message just above, I've incorporated the latest you given me for the header and first cell of my form. Each cell of my form is inputting data for filters for selected reports. I plan to increase the number of cells in this form table once I could get the initial results of the first cell in the form to work.

Some of my reports will involve just filling in calendar picklist dates which should go into PV0 and PV1 of my report filters and others will involve that but also entering a dynamic date option as a PV2 filtering option. You could see that right now just two of my reports are requiring a dynamic picklist choise date entry to go into a PV2 report filter position.

I don't know much of the development world but from my understanding, the first PV number in the coding refers to the positioning of the filter in the desired report (i.e. PV0, PV1 and PV2) but the second PV number is an ID identifier which will have to be different for each case as they cannot be duplicated across the form (correct me if I'm wrong).

I don't quite understand the logic in the header as far as what it's saying as I'm not familiar. I tested the first part of the form with what you sent me and it's strange but the only time the PV2 entry works properly is when I select "TODAY" or "YESTERDAY" as the dynamic date options. I don't udnerstand why the other options don't go into my report correctly. Not only that they don't go into PV2 correctly but any calendar picker entry I would have entered for PV0 and PV1 in this situation will not update correctly either. THe calendar picker options do update but only when the entry for PV2 filter goes in correctly i.e. for "TODAY" or "YESTERDAY" options.

Can you help me correct this and understan why this is happenening? Also, I assume I would need to make some kind of changes to the other quadrants of my form in terms of the PV codes so they don't duplicate? Can you help me update these? For all of my reports, I will need the calendar picker options to go into PV0 and PV1 and when needed the dynamic date netry to go into PV2. But again, the IDs need to change as well which is where I would need your help.

Thank you in advance!
 
Andrea SloanAndrea Sloan
Hi Pramodh:

Would you ahve any updates on this???
Scott M - SFDC FanScott M - SFDC Fan
Hi Andrea,

Did you ever get this figured out?

Scott