To get values from input field in controller extension using Apex

The following code explains how to get values from <apex:inputfield> in controller extension using apex

Visualforce:

  <apex:pageblock title="Blog" mode="edit" >
    <apex:pageBlockButtons >
      <apex:commandButton action="{!nxt}" value="Next"/>
    </apex:pageBlockButtons>
    <apex:pageBlockSection columns="1">
      <apex:inputField value="{!Blog__c.name}"/>
      <apex:inputField value="{!Blog__c.URL__c}"/>
    </apex:pageBlockSection>
  </apex:pageblock>

Apex:

  Public Blog__c blg;
  this.blg = (Blog__c)controller.getRecord();

  String nam = blg.name;

  Sting url = blg.URL__c;

Cheers!!!

3 comments: