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
Mr.BrooksMr.Brooks 

Passing input text value from visualforce page to controller

Hi, I am trying to sync my contact on with my account owner but entering the dealer number in through a vf page and passing it to a SOQL query in apex. here is my code:

Page:<apex:page standardController="Contact" extensions="DealerContactOwnerSync" >
  <apex:form >
      <tabel >
          <tr>
              <td></td><td>Enter Dealer Number:<apex:inputText value="{!dlrNum}" /></td><br/>
          </tr>
          <tr>
              <td><apex:commandButton value="Sync This Dealer" action="{!dealershipSync}"/></td>
              <td></td>
          </tr>
      </tabel>
  </apex:form>
 
</apex:page>

Controller: 

public string dlrNum; //dealer number
public String getdlrNum(){
   
        return dlrNum;
    }
   
   
    public void setdlrNam(String s) {
        dlrNum= s;
    }
   
   
   
  
  
   Public void dealershipSync(){
      
        //String branchNumber = ApexPages.currentPages.getParameters.get("branch number");

        for(Contact c : [SELECT account.OwnerId, account.Id, account.branch_number__c, account.owner.isActive, account.Active__c, account.Name, account.GMF_ACF__c, Id, OwnerId , Name FROM Contact where end_date__c = null and CreatedDate >= 2008-10-03T00:00:00Z and account.recordtypeid ='01230000000DD54AAG' and account.owner.House_Account__C = false and account.owner.isActive = true  and account.active__c = 'Y' and account.dealer_number__c =:dlrNum order by account.LastModifiedDate limit :iContactBatchSize] ){
                System.debug('Dealer Number is:***************** ' + dlrNum);
                if(c.OwnerID != c.account.OwnerID){
                    Contact mContact = new Contact();
Sonam_SFDCSonam_SFDC
your code looks correct - the way you have passed the value from the VF to controller - what is the exact issue you are facing here?

Are you getting any error messages on the VF page?
Mr.BrooksMr.Brooks
when i have value in the input field it wont save and says dlrNum is read only and when the value is not in the input field dlrNum returns null in my debug statement.