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
shakila Gshakila G 

how to pass a input value VF to Apex Class?

Hi All,
Am trying to Writrive all the opportunity records based on month given as an Input though VF page.

How to get the Input value from VF to Apex Class?

My APex Class
public with sharing class updateincentive {
 Opportunity opp;
 Public  Integer Thismonth {Get;Set;}
    public updateincentive(ApexPages.StandardSetController controller) {
     opp = (Opportunity) controller.getRecord();   
     
    }

    public List<Opportunity> getFinalPayOpp() {
         
        return [select Name,Hidden_Project_Created__c,Customer_Slab_Type__c,IncentiveSlab__c,NewIncentivePercentage__c,Incentive_Amount__c,Incentive_For__c,No_of_Days__c,Date__c
              from Opportunity where CALENDAR_MONTH(Final_Full_Payment_Date__c)=:Thismonth and  Hidden_Final_Pay_Created__c=True  ];
     
    }                                    
}

 
bhanu_prakashbhanu_prakash
Hi,
Mark as best answer, If it resloves !!
Need to add in controller
public Oppournity  opp{get; set;}

and need to add  requested fields in vf page 
VF page:
               <apex:inputField value="{!opp.Name}" />
               <apex:inputField value="{!opp.stage}" />

Mark as resloved if it helps :) :)
Thanks, 
Bhanu Prakash
visit ForceLearn.com (https://www.forcelearn.com/)  
shakila Gshakila G
 <apex:inputText Value="{!Thismonth }"/>    
 I have entered the values in this field.
(This month ) it's not a standard Field. Then How can I pass this value into Search Button?  
Ajay K DubediAjay K Dubedi
Hi Shakila,
Check below sample code:

Visualforce Page =>

<apex:page controller="PassParamFromVFtoController">
    <!-- Pass parameters from visualforce page to controller -->
    <apex:form >
            <apex:pageblock >
                  Input your query <apex:inputText value="{!myInputQueryString}"/>
                 <apex:commandButton value="Submit" reRender="DisplayInputQueryID" action="{!myInputQuery}"/>
            </apex:pageblock>
            <apex:pageblock >
                 <b>Output : </b><apex:outputText value="{!myoutputString}" id="DisplayInputQueryID"/>
            </apex:pageblock>
    </apex:form>
</apex:page>

Apex Controller =>

Public with sharing class PassParamFromVFtoController {
  Public string myInputQueryString{get;set;}
  Public string myoutputString{get;set;}
   
  Public void myInputQuery(){
  myoutputString = myInputQueryString ;
  }
}

Refer This URL:
https://salesforce.stackexchange.com/questions/14675/how-to-get-the-text-fields-values-in-the-controller-class-without-using-any-scri

Please let me know if you have any query.
Please mark it as best Answer if you find it helpful.

Thank You
Ajay Dubedi