Saturday, 7 May 2016

PAGEREFERENCE AND EXTENSION AND SOQL Using Custom Controller

PAGEREFERENCE AND EXTENSION AND SOQL Using Custom Controller


<apex:page controller="CallVfDemoController">
<apex:form>
<apex:pageBlock>
<apex:commandButton value="Call Contact Page" action="{!Callcontactpage}"/>
<apex:commandButton value="Call Acount Page" action="{!Call_VF_Page}"/>
</apex:pageBlock>
</apex:form>
</apex:page>



Public with sharing class CallVfDemoController {
 
  Public CallVfDemoController(){
  }
   
  Public pagereference Call_VF_Page(){
    PageReference openvfpage = New Pagereference('/apex'+'/DemovfPage');
    openvfpage.setRedirect(false); 
    return openvfpage ;
    return openvfpage ;
  }
  Public pagereference Callcontactpage(){
   PageReference openvfpage2 = New Pagereference('/apex'+'/DemovfPage2');
   openvfpage2.setRedirect(false); 
 return openvfpage2 ;
  }
  
  
}



<apex:pagestandardcontroller="Account" sidebar="false" showHeader="false">
<apex:form>
   Welcome TO PAge2
<apex:pageBlock Title="Account">
<apex:pageBlockButtons>
<apex:commandButton Value="Save" Action="{!save}"/>
<apex:commandButton Value="Edit" Action="{!edit}"/>
 
</apex:pageBlockButtons>
<apex:pageBlockSection Title="Records">
<apex:InputField value="{!Account.Name}"/>
<apex:InputField value="{!Account.Industry}"/>
 
 
 
 
 
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>


<apex:pagestandardcontroller="Registrations__c" extensions="Regsearch2">
<apex:form>
 
 
<apex:OutputLabel Value="Enter Name For Register User"></apex:OutputLabel>
<apex:Inputtext value="{!searchname}"/>
<apex:commandButton Value="Search" action="{!searchrecords}"/>
<apex:pageBlock>
<apex:pageBlockTable value="{!searchrecords}" var="y" >
<apex:column value="{!y.Id}"/>
<apex:column value="{!y.Account__c}"/>
<apex:column value="{!y.Email__c}"/>
<apex:column value="{!y.Name__c}"/>
 
 
 
</apex:pageBlockTable>
 
 
</apex:pageBlock>
 
 
 
</apex:form>
 
 
</apex:page>


Extension Controller with Soql _________________


Public with sharing class Regsearch2{

    public PageReference searchrecords() {
        return null;
    }
    
    Public Regsearch2(ApexPages.StandardController stdController){
    
    
    }

Public String searchname{set;get;}
Public List<Registrations__c> regs;

Public List<Registrations__c>  getsearchrecords(){
regs=[SELECT Id,Account__c,Email__c,Name__c,Sur_Name__c FROM Registrations__c Where Name__c=:searchname];
return regs;
}


}

RECORDSETVAR

<apex:pagestandardController="contact" recordSetVar="contacts" showHeader="false" sidebar="false">
<apex:form>
<apex:pageBlockTabStyle="Account" >
<apex:pageBlockTable value="{!contacts}" var="y">
<apex:column Value="{!y.Account.Name}"/>
<apex:column Value="{!y.Name}"/>
<apex:column Value="{!y.Phone}"/>
<apex:column Value="{!y.Email}"/>
 
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
 


APEX TRIGGERS

Custom setting Example:

trigger customsettingexample on Opportunity (before insert) {
  // Grab your Custom Setting values
  CSR_Settings__c settings = CSR_Settings__c.getInstance('csr');
  String  CSR_USER_ID      = settings.CSR_User_ID__c;
  Decimal OPP_MIN_VALUE    = settings.Opp_Minimum_Value__c;

  // Create a master list of accounts to bulk update
  List<Account> accounts = new List<Account>();
 
  for (Opportunity opp : Trigger.new) {
    // Make sure we meet the minimum threshold
    if (opp.Amount >= OPP_MIN_VALUE) {
      // This is a trick to get the related account!
 
      Account acc = new Account();
        acc.Name=opp.AccountId;
      acc.Id      = opp.AccountId;
     
      // Update the CSR and add to master list
     // acc.CSR__c  = CSR_USER_ID;
      accounts.add(acc);
    }
  }
  // Update the master list of accounts
 // update accounts;
 insert accounts;
}
_____________________________________________________________
================================================================
New NOTE create
----------------

trigger insertNote on Contact (after insert, after update){

    List<Note> noteList = new List<Note>();

    if(Trigger.isAfter && Trigger.isInsert){

        for(Contact c : trigger.new){
        //c.MobilePhone='123456789';
 
            if(c.LastName != null){
                Note newNote = new Note();
                newNote.Title = 'Updated contact Record';
                newNote.Body = c.LastName;
                newNote.ParentId = c.Id;
                noteList.add(newNote);
            }
        }
    }

    if(Trigger.isAfter && Trigger.isUpdate){
        for(Contact c : trigger.new){
        // c.MobilePhone='123456789';
 
            if(trigger.oldMap.get(c.id).LastName != c.LastName){
                Note newNote = new Note();
                newNote.Title ='Updated contact Record';
                newNote.Body = c.LastName;
                newNote.ParentId = c.Id;
                noteList.add(newNote);
            }
        }
    }

    if(noteList.size() > 0){
        insert noteList;
    }
}
======================================================================================
-----------------------------------------------------------------------------------------
Ne note on Account object
---------------------------
===============================

trigger insertnoteonacc on Account (Before insert,after insert, after update){

    List<Note> noteList = new List<Note>();

    if(Trigger.isBefore && Trigger.isInsert){
    for(Account c : trigger.new){
        c.Phone='123456789';
    // Note newNote = new Note();
      //          newNote.Title = 'Updated ACC Record';
      //          newNote.Body = 'Name';
      //        newNote.ParentId = krishna138;
      //          noteList.add(newNote);
     //   insert noteList;
    }  
    }
       
     
   
   
 
     if(Trigger.isAfter && Trigger.isInsert ){
       
        for(Account c : trigger.new){
   
            if(c.Name != null){
                Note newNote = new Note();
                newNote.Title = 'Updated ACC Record';
                newNote.Body = c.Name;
                newNote.ParentId = c.Id;
                noteList.add(newNote);
            }
        }
    }

    if(Trigger.isAfter && Trigger.isUpdate){
       
          for(Account c : trigger.new){
 
            if(trigger.oldMap.get(c.id).Name != c.Name){
                Note newNote = new Note();
                newNote.Title ='Updated Acc Record';
                newNote.Body = c.Name;
                newNote.ParentId = c.Id;
                noteList.add(newNote);
            }
        }
    }

    if(noteList.size() > 0){
      insert noteList;
    }
}
=========================================================================================
------------------------------------------------------------------------------------------------------
No Phone Number simple
+++++++++++++++++++++++++++
+++++++++==================



trigger nophonenum on Account (before insert) {
    for(Account a:Trigger.New){
        if(a.phone=='' || a.phone==null){
            a.addError('Phone no is a must ');
        }
    }
}


-----------------------------------------------------


sample
===========



trigger SampleTrigger8 on Opportunity (before insert,before Update) {



for(Opportunity opp:Trigger.New){
if(Opp.StageName == 'Closed Lost')
{
Opp.Description='Updated';

}
else
{
Opp.Description='Not Updated';
}

}
}


=============================================




Send Email Job Trigger
=====================
---------------------
+++++++++++++++++++++


trigger SendEmailJob on Opportunity (after insert,after update) {

    Set<Id> setResource=new Set<Id>();
    Set<Id> setjob=new Set<Id>();
    List<NewJob__c> LatestJob=new List<NewJob__c>();
    for(Opportunity opp:Trigger.new){
        if(opp.Status__c == 'new'){
            if(opp.Resource__c != null ){
                setResource.add(opp.Resource__c);
         
            }
        }
    }

    List<String> lstEmails=new List<String>();
    if(!setResource.isEmpty()){
        List<Resource__c> lstResource= [Select Id,Email__c from Resource__c Where Id IN : setResource];
        if(!lstResource.isEmpty())
        {
            for(Resource__c res:lstResource)
            {
                lstEmails.add(res.Email__c);
            }
        }
    }

    List<NewJob__c> newJoblist=[SELECT Id FROM NewJob__c order by CreatedDate desc Limit 1];


        if(!newJoblist.isEmpty())
        {
             for(NewJob__c jobl:newJoblist){
              setjob.add(jobl.id);
   
           }
       }

 

    String Body='';
    if(!setjob.isEmpty()){
        List<Job_Application__c> Joblist=[SELECT Id FROM Job_Application__c WHERE Job__r.Id IN:setjob];
        if(!Joblist.isEmpty())
        {
            for(Job_Application__c job:Joblist){
                body=body+'https://ap2.salesforce.com/'+job.id+'\n';
             
            }
        }
    }

    if(!lstEmails.isEmpty()){
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(lstEmails);  
        mail.setSubject('Job Alert');
        mail.setPlainTextBody(Body);
        mail.setHtmlBody(Body);
        Messaging.SendEmail(new Messaging.SingleEmailMessage[] {mail});
    }
}


============================================================================================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 another Send Job mail
______________________________________________________________




trigger SendEmailUser on Opportunity (after insert,after update) {
   
    Set<Id> setResource=new Set<Id>();
    Set<Id> setjob=new Set<Id>();
    List<NewJob__c> LatestJob=new List<NewJob__c>();
    for(Opportunity opp:Trigger.new){
        if(opp.Status__c == 'new'){
            if(opp.Resource__c != null ){
                setResource.add(opp.Resource__c);
              //  setjob.add(opp.Job__c);
            }
        }
    }
   
    List<String> lstEmails=new List<String>();
    if(!setResource.isEmpty()){
        List<Resource__c> lstResource= [Select Id,Email__c from Resource__c Where Id IN : setResource];
        if(!lstResource.isEmpty())
        {
            for(Resource__c res:lstResource)
            {
                lstEmails.add(res.Email__c);
            }
        }
    }
  // Set<String> nid=new Set<String>();
   // LatestJob=[SELECT Id FROM NewJob__c ORDER BY LastModifiedDate LIMIT 1];
   
   
   
   
   
    String Body='';
    if(!setResource.isEmpty()){
        List<Job_Application__c> Joblist=[SELECT Id FROM Job_Application__c order by CreatedDate desc limit 1];
        if(!Joblist.isEmpty())
        {
            for(Job_Application__c job:Joblist){
                body=body+'https://ap2.salesforce.com/'+job.id+'\n';
            }
        }
    }
   
    if(!lstEmails.isEmpty()){
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(lstEmails);  
        mail.setSubject('Job Alert');
        mail.setPlainTextBody(Body);
        mail.setHtmlBody(Body);
        Messaging.SendEmail(new Messaging.SingleEmailMessage[] {mail});
    }

}


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++
======================================================================================\\


Test Trigger
__________
+++++++++++++++

trigger testtrigger on Account (after insert) {
   
    List<Note> noteList = new List<Note>();
       for(Account a:Trigger.New)
        if(a.Website != null){  
        a.Website='www.techyerru.com';
                Note newNote = new Note();
                newNote.Title = 'Custom Title';
                newNote.Body = 'webnote';
                newNote.ParentId = a.Id;
                noteList.add(newNote);
            }
   
     if(noteList.size() > 0){
        insert noteList;

         
         
     }      
}


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
=============================================================================================

once user register with details send a mail to that user associate email with data and CC BB details
=======================================================================================================


// Send a business proposal to each new Contact
trigger sendemail on Registrations__c (before insert) {
  // Step 0: Create a master list to hold the emails we'll send
  List<Messaging.SingleEmailMessage> mails =new List<Messaging.SingleEmailMessage>();
 
  for (Registrations__c myContact : Trigger.new) {
    if (myContact.Email__c != null && myContact.Account__c != null) {
      // Step 1: Create a new Email
      Messaging.SingleEmailMessage mail =
      new Messaging.SingleEmailMessage();
   
      // Step 2: Set list of people who should get the email
      List<String> sendTo = new List<String>();
      sendTo.add(myContact.Email__c);
      mail.setToAddresses(sendTo);
   
      // Step 3: Set who the email is sent from
      mail.setReplyTo('krishna.yerru@gmail.com');
      mail.setSenderDisplayName('Techyerru update');
   
      // (Optional) Set list of people who should be CC'ed
      List<String> ccTo = new List<String>();
      ccTo.add('kyerru@gmail.com');
      mail.setCcAddresses(ccTo);

      // Step 4. Set email contents - you can use variables!
      mail.setSubject('URGENT BUSINESS PROPOSAL');
      String body = 'Dear ' + myContact.Name__c + ', ';
      body += 'I confess this will come as a surprise to you.';
      body += 'I am John Alliston CEO of the Bank of Nigeria.';
      body += 'I write to request your cooperation in this ';
      body += 'urgent matter as I need a foreign partner ';
      body += 'in the assistance of transferring $47,110,000 ';
      body += 'to a US bank account. Please respond with ';
      body += 'your bank account # so I may deposit these funds.';
      mail.setHtmlBody(body);
   
      // Step 5. Add your email to the master list
      mails.add(mail);
    }
  }
  // Step 6: Send all emails in the master list
  Messaging.sendEmail(mails);
}

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
=================================================================================================================




Thursday, 28 April 2016

VF 2


SAMPLE FIELDS inserting


<apex:page standardController="Opportunity" tabStyle="Opportunity">

<apex:form >
<apex:pageBlock >

<apex:pageBlockSection title="Opportunity Information">

<apex:outputField value="{!opportunity.name}"/>



<apex:outputField value="{!opportunity.amount}"/>

<apex:outputField value="{!opportunity.closeDate}"/>

</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:inputField value="{!opportunity.name}"/>
<apex:inputText value="{!opportunity.name}"/>
</apex:pageBlockSection>

<apex:pageBlockSection title="outputtest and inputtext">
<apex:outputLabel value="Opp Name"></apex:outputLabel>
<apex:inputText />

</apex:pageBlockSection>

</apex:pageBlock>
</apex:form>
</apex:page>


 
SAMPLE SOQL
 
 
 
<apex:page controller="SampleSoql">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
 
<apex:inputText value="{!Searched}"/>
<apex:commandButton value="Submit" Action="{!Submit}"/>
<apex:pageBlockTable value="{!accs}" var="a">
<apex:column Value="{!a.Name}"></apex:column>
<apex:column Value="{!a.Industry}"></apex:column>
 
</apex:pageBlockTable>
 
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
 

2

<apex:page controller="samplesoql2">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
 
<apex:inputText value="{!Searched}"/>
<apex:commandButton value="Submit" Action="{!Submit}"/>
<apex:pageBlockTable value="{!cons}" var="a">
<apex:column Value="{!a.Owner}"></apex:column>
 
</apex:pageBlockTable>
 
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Schema example
<apex:page controller="SchemaExample">
<apex:form >
<apex:panelGrid columns="3" id="one">
<apex:selectList value="{!selected}" size="1">
<apex:selectOptions value="{!options}" />
<apex:actionSupport event="onchange"  action="{!getDetails}" reRender="one" />
</apex:selectList>
<apex:commandButton value="GetProperties" action="{!getDetails}" />
<apex:inputTextArea value="{!describe}" rows="5" cols="70" />
</apex:panelGrid>
</apex:form>
 
</apex:page>
Schema 2
<apex:page controller="SchemaExample">
<apex:form >
<apex:panelGrid columns="3" id="one">
<apex:selectList value="{!selected}" size="1">
<apex:selectOptions value="{!options}" />
<apex:actionSupport event="onchange"  action="{!getDetails}" reRender="one" />
</apex:selectList>
<apex:commandButton value="GetProperties" action="{!getDetails}" />
<apex:inputTextArea value="{!describe}" rows="5" cols="70" />
</apex:panelGrid>
</apex:form>
 
</apex:page>
 


Select   vf Component
<apex:page controller="selectcomponent" sidebar="false" setup="false" showHeader="false" >
<apex:Form >
<apex:Pageblock >
 
<apex:outputLabel value="Enter grade"></apex:outputLabel><br/>
<apex:SelectList size="1">
<apex:selectoption itemlabel="None" Itemvalue="NONE"/>
<apex:selectoption itemlabel="one" Itemvalue="1"/>
<apex:selectoption itemlabel="two" Itemvalue="2"/>
<apex:selectoption itemlabel="three" Itemvalue="3"/>
</apex:SelectList>
</apex:PageBlock>
<apex:PageBlock >
<apex:outputlabel Value="Enter Submited Documents"/>
<apex:SelectCheckboxes >
<apex:selectOption Itemlabel="SSC" ItemValue="1"/>
<apex:selectOption Itemlabel="Inter" ItemValue="2"/>
<apex:selectOption Itemlabel="B.Tech" ItemValue="3"/>
</apex:SelectCheckboxes>
</apex:pageblock>
<apex:Pageblock >
<apex:OutputLabel Value="Select gender"/>
<apex:SelectRadio >
<apex:selectOption Itemlabel="Male" ItemValue="1"/>
<apex:selectOption Itemlabel="Female" ItemValue="2"/>
</apex:SelectRadio>
 
<apex:outputLabel value="InputSecret "/>
<apex:inputSecret />
 
 
 
<apex:outputLabel value="InputCheckBox "/>
<apex:inputCheckBox />
<apex:commandButton Value="Submit" action="{!save}"/>
 
 
 
 
</apex:pageblock>
</apex:Form>
</apex:page>
 
Select pick list example
<apex:page controller="selectlistexampl">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
 
<apex:outputLabel value="Select option"></apex:outputLabel>
<apex:selectList size="1" value="{!selected}" >
<apex:selectOptions value="{!options}" />
<apex:actionSupport event="onchange" action="{!selected}" reRender="res" />
</apex:selectList>
<apex:outputLabel value="{!result}" id="res" />
 
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
 
 
</apex:page>
 

<apex:page controller="selectlistexampl">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
 
<apex:outputLabel value="Select option"></apex:outputLabel>
<apex:selectList size="1" value="{!selected}" >
<apex:selectOptions value="{!options}" />
<apex:actionSupport event="onchange" action="{!selected}" reRender="res" />
</apex:selectList>
<apex:outputLabel value="{!result}" id="res" />
 
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
 
 
</apex:page>
 


Select page Renndered

<apex:page controller="javascriptList" renderAs="pdf">
 
<apex:image value="{!$Resource.krishnayerru}" />
 
 
 
<h1>
 
         Products Purchased
 
</h1>
 
<table width="100%">
 
<tr style="background:#848484;">
 
<td>Name </td>
 
<td>Price</td>
 
<td>Quantity</td>
 
<td>Total</td>
 
</tr>
 
<apex:repeat value="{!selected}" var="a">
 
<tr >
 
<td>{!a.name}</td>
 
<td>{!a.price}</td>
 
<td>{!a.quant}</td>
 
<td>{!a.total}</td>
 
</tr>
 
</apex:repeat>
 
</table>
 
</apex:page>
 

SOQL PAGINATION

<apex:page controller="SOQLPagination" >
 
<apex:form >
 
<apex:pageBlock title="Account Pagination" id="one">
 
<apex:pageBlockTable value="{!accs}" var="a">
 
<apex:column value="{!a.name}" />
 
<apex:column value="{!a.industry}" />
 
</apex:pageBlockTable>
 
<apex:pageBlockButtons location="bottom">
 
<apex:outputPanel >
 
<apex:inputText value="{!flimit}" size="2" />
 
of<apex:inputText value="{!acount}" size="2"/>
 
disabled="{!flimit <=0}" />
 
disabled="{!flimit+size > acount }" />
 
</apex:outputPanel>
 
<apex:commandButton value="Previous" action="{!previous}"/>
 
<apex:commandButton value="Next" action="{!next}"/>
 
</apex:pageBlockButtons>
 
</apex:pageBlock>
 
</apex:form>
 
</apex:page>

STANDARD OBJECT FIELDS TO VFPAGE FOR INSERt
<apex:page standardController="Account">
<apex:form >
<apex:pageBlock title="My Content" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
 
</apex:pageBlockButtons>
<apex:pageBlockSection title="My Content Section" columns="2">
<apex:inputField value="{!Account.Name}"/>
<apex:inputField value="{!Account.SLA__c}"/>
<apex:inputField value="{!Account.SLASerialNumber__c}"/>
<apex:inputField value="{!Account.SLAExpirationDate__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
 

 
STANDARD OBJECT FIELDS TO VFPAGE FOR INSERt
 
<apex:page standardController="Opportunity">
<apex:form >
<apex:pageBlock title="My Content" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!edit}" value="Edit"/>
<apex:commandButton action="{!delete}" value="Delete"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="My Content Section" columns="2">
<apex:inputField value="{!Opportunity.Name}"/>
<apex:inputField value="{!Opportunity.CloseDate}"/>
<apex:inputField value="{!Opportunity.StageName}"/>
<apex:inputField value="{!Opportunity.Resource__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
TAB PANEL USING CSS

<apex:page standardController="Account" recordSetVar="items">
 
<style>
 
    .tab1{
 
    width:120px;
 
    height:30px;
 
       color:blue;
 
    }
 
</style>
 
<apex:tabPanel >
 
<apex:tab label="PageBlockTable" labelWidth="100"  styleClass="tab1">
 
<apex:pageBlock title="PageBlockTable">
 
<apex:pageBlockTable value="{!items}" var="a">
 
<apex:column value="{!a.name}" />
 
<apex:column value="{!a.industry}" />
 
</apex:pageBlockTable>
 
</apex:pageBlock>
 
</apex:tab>
 
<apex:tab label="DataTable" labelWidth="100" styleClass="tab1">
 
<apex:pageBlock title="DataTable">
 
<apex:dataTable value="{!items}" var="a">
 
<apex:column value="{!a.name}" />
 
<apex:column value="{!a.industry}" />
 
</apex:dataTable>
 
</apex:pageBlock>
 
</apex:tab>
 
<apex:tab label="DataList" labelWidth="100" styleClass="tab1" >
 
<apex:pageBlock title="DataList">
 
<apex:dataList value="{!items}" var="a">
 
                {!a.name}
 
 
 
</apex:dataList>
 
</apex:pageBlock>
 
</apex:tab>
 
<apex:tab label="Repeat" labelWidth="100"  styleClass="tab1">
 
<apex:pageBlock title="Repeat">
 
<apex:repeat value="{!items}" var="a">
 
                {!a.name}
 
</apex:repeat>
 
</apex:pageBlock>
 
</apex:tab>
 
</apex:tabPanel>
 
</apex:page>
 
TESTEXAM

<apex:page controller="testexam">
<apex:form >
<apex:PageBlock >
 
 
<apex:outputLabel Value="Entername"></apex:outputLabel>
<apex:inputText value="{!Name}"/>
 
</apex:PageBlock>
<apex:pageblock >
 
<apex:OutputLabel value="Your Entered Name Is"></apex:OutputLabel>
 
 
 
 
 
 
<apex:pageblockButtons >
<apex:commandButton Value="Save Name" Action="{!getname}"/>
         {!s}
 
 
</apex:pageblockButtons>
 
</apex:pageBlock>
</apex:form>
</apex:page>

 
NewAndExistingController2
 
 
<apex:page controller="NewAndExistingController2" tabstyle="Account">
 
<apex:form >
 
<apex:pageBlock >
 
<apex:pageMessages />
 
<apex:pageBlockSection >
 
<apex:inputField value="{!Account.name}"/>
 
<apex:outputField value="{!Account.name}"/>
 
<apex:inputField value="{!Account.phone}"/>
 
<apex:outputField value="{!Account.phone}"/>
 
<apex:inputField value="{!Account.industry}"/>
<apex:outputText value="{!Account.industry}"/>
<apex:outputText />
 
</apex:pageBlockSection>
<apex:pageBlock >
<Apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:OutputLabel Value="Sim Type"></apex:OutputLabel>
<apex:selectList required="true" size="1">
<apex:selectOption itemValue="one" itemLabel="Airtel"></apex:selectOption>
<apex:selectOption itemValue="two" itemLabel="BSNl"></apex:selectOption>
<apex:selectOption itemValue="three" itemLabel="Idea"></apex:selectOption>
<apex:selectOption itemValue="one" itemLabel="Vodafone"></apex:selectOption>
</apex:selectList>
</apex:pageBlockSectionItem>
 
 
<apex:pageBlockSectionItem >
<apex:OutputLabel Value="Locaton "></apex:OutputLabel>
<apex:selectList required="true" size="1" >
<apex:selectOption itemValue="one" itemLabel="AP"></apex:selectOption>
<apex:selectOption itemValue="two" itemLabel="Telangana"></apex:selectOption>
<apex:selectOption itemValue="three" itemLabel="Tamilanadu"></apex:selectOption>
<apex:selectOption itemValue="one" itemLabel="Karnataka"></apex:selectOption>
</apex:selectList>
</apex:pageBlockSectionItem>
</Apex:pageBlockSection>
 
</apex:pageBlock>
 
<apex:pageBlockButtons location="bottom" onmouseup="Submit Ka Button">
 
<apex:commandButton value="Save" action="{!save}"/>
 
</apex:pageBlockButtons>
 
</apex:pageBlock>
 
</apex:form>
 
</apex:page>
 
<apex:page controller="yerru8">
<apex:form >
<apex:PageBlock Title="Regs">
<apex:PageBlockTable Value="{!Regs}" Var="y">
<apex:column value="{!y.First_Name__c}" />
<apex:column value="{!y.Last_Name__c}" />
<apex:column value="{!y.Mobile__c}" />
<apex:column value="{!y.Status__c}" />
 
 
 
</apex:PageBlockTable>
 
 
</apex:PageBlock>>
 
</apex:form>
 
 
 
</apex:page>
 




Visual Pages For Controllers 1

ACCinsert

<apex:page standardController="Account">

<apex:form >

<apex:pageBlock title="My Content" mode="edit">

<apex:pageBlockButtons >

<apex:commandButton action="{!save}" value="Save"/>

</apex:pageBlockButtons>

<apex:pageBlockSection title="My Content Section" columns="2">

<apex:inputField value="{!account.name}"/>

<apex:inputField value="{!account.site}"/>

<apex:inputField value="{!account.type}"/>

<apex:inputField value="{!account.accountNumber}"/>

<apex:inputField value="{!account.YearStarted}"/>
<apex:outputLabel Value="{!account.type}"></apex:outputLabel>

<apex:inputField value="{!account.AccountSource}"/>
<apex:inputField value="{!account.Active__c}"/>


</apex:pageBlockSection>

</apex:pageBlock>

</apex:form>

</apex:page>

Acccontroller3


<apex:page controller="AccountController3">
<apex:form >
<apex:pageBlock title="My Content" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="My Content Section" columns="2">
<apex:inputField value="{!account.name}"/>
<apex:inputField value="{!account.site}"/>
<apex:inputField value="{!account.type}"/>
<apex:inputField value="{!account.accountNumber}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>


Accountpagenatuion

<apex:page standardController="Account" recordSetVar="accounts" extensions="AccountPagination">

<apex:pageBlock title="Viewing Accounts">

<apex:form id="theForm">

<apex:pageBlockSection >

<apex:dataList value="{!accountPagination}" var="acct" type="1">

                    {!acct.name}

</apex:dataList>

</apex:pageBlockSection>

<apex:panelGrid columns="2">

<apex:commandLink action="{!previous}">Previous</apex:commandlink>

<apex:commandLink action="{!next}">Next</apex:commandlink>

</apex:panelGrid>

</apex:form>

</apex:pageBlock>

</apex:page>


Accountfunctionwithparameter

<apex:page controller="exampleCon">

<apex:form >

<!-- Define the JavaScript function sayHello-->

<apex:actionFunction name="sayHello" action="{!sayHello}" rerender="out" status="myStatus"/>

</apex:form>



<apex:outputPanel id="out">

<apex:outputText value="Hello "/>

<apex:actionStatus startText="requesting..." id="myStatus">

<apex:facet name="stop">{!username}</apex:facet>

</apex:actionStatus>

</apex:outputPanel>



<!-- Call the sayHello JavaScript function using a script element-->

<script>window.setTimeout(sayHello,2000)</script>



<p><apex:outputText value="Clicked? {!state}" id="showstate" /></p>



<!-- Add the onclick event listener to a panel. When clicked, the panel triggers

    the methodOneInJavascript actionFunction with a param -->

<apex:outputPanel onclick="methodOneInJavascript('Yes!')" styleClass="btn">

        Click Me

</apex:outputPanel>

<apex:form >



<apex:actionFunction action="{!methodOne}" name="methodOneInJavascript" rerender="showstate">

<apex:param name="firstParam" assignTo="{!state}" value="" />

</apex:actionFunction>

</apex:form>

</apex:page>
Actionpoolerwithstatus

<apex:page controller="exampleCon2">

<apex:form >

<apex:outputpanel id="counter">

<apex:outputText value="Click Me!: {!count}"/>

<apex:actionSupport event="onclick"

                                action="{!incrementCounter}"

                                rerender="counter" status="counterStatus"/>

</apex:outputpanel>

<apex:actionStatus id="counterStatus"

                           startText=" (incrementing...)"

                           stopText=" (done)"/>

</apex:form>

</apex:page>
Arrayexample


<apex:page controller="arrayexample">
<apex:form >
<apex:commandButton value="click" action="{!show}"/>
<apex:pageBlock title="Arrayexmple">
<apex:pageBlockTable value="{!ages}" var="a">
<apex:column value="{!a}"/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title="Account">
<apex:pageBlockTable value="{!accs}" var="a">
<apex:column value="{!a.Name}"/>
<apex:column value="{!a.Industry}"/>

</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock id="one" rendered="{!ISNULL(cons)}">
<apex:pageBlockTable value="{!cons}" var="a">
<apex:column value="{!a.lastname}"/>
<apex:column value="{!a.phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

Autocomplete

<apex:page controller="AutoComplete">
<script src="https://code.jquery.com/jquery-1.8.2.js"></script>
<script src="https://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css"/>

<script type="text/javascript">
        var j$ = jQuery.noConflict();
        var names =[];
<apex:repeat value="{!accounts}" var="a">
               names.push('{!a.name}');
</apex:repeat>
        j$(document).ready(function(){
            j$("#mydata").autocomplete({
                source : names
            });
        });
</script>
<apex:form >
        Account Name<input type="text" id="mydata"/>

</apex:form>

</apex:page>
================
Campigndatausingvfpage
<apex:page standardController="Campaign">
<apex:form >
<apex:pageBlock title="My Content" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>


</apex:pageBlockButtons>
<apex:pageBlockSection title="My Content Section" columns="2">
<apex:inputField value="{!Campaign.Name}"/>
<apex:inputField value="{!Campaign.StartDate}"/>
<apex:inputField value="{!Campaign.Type}"/>
<apex:inputField value="{!Campaign.Status}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

Controlleraction

<apex:page controller="Controlleraction">
<apex:form >
<apex:actionFunction action="{!createFruitList}" name="generateFruits" reRender="selFruits"  />
<br/>
        Select the Alphabet:
<apex:selectList id="selAlphabets" value="{!SelectedAlphabet}" size="1" onchange="generateFruits()">
<apex:selectOptions value="{!Alphabets}">
</apex:selectOptions>
</apex:selectList>
<br/>
        Select the Fruit:
<apex:selectList id="selFruits" size="1">
<apex:selectOptions value="{!Fruits}">
</apex:selectOptions>
</apex:selectList>


</apex:form>
</apex:page>

convsbad

<apex:page controller="conVsBad">

  getContactMethod2(): {!contactMethod2.name} <br/>


    getContactMethod1(): {!contactMethod1.name}

</apex:page>

CustomobjectwithVfpagesave
<apex:page standardController="Status__c" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel >Registerationforcard</apex:outputLabel>
<apex:inputField id="FirstName" value="{!Status__c.Cardtype__c}"/>
</apex:pageBlockSectionItem><apex:pageBlockSectionItem >
<apex:outputLabel >Name</apex:outputLabel>
<apex:inputText value="{!Status__c.Name__c}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton id="Save" action="{!Save}" value="Save"/>
<apex:commandButton id="Cancel" action="{!Cancel}" value="Cancel"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Exam

<apex:page >
<apex:form >
<apex:pageBlock title="reg">
<apex:pageBlockSection columns="3">

<apex:pageBlockSectionItem >

<apex:outputLabel value="NAME" style="bold" />
<apex:pageBlockSectionItem >
<apex:inputText /></apex:pageBlockSectionItem>
</apex:pageBlockSectionItem>

<apex:inputText />


</apex:pageBlockSection>

</apex:pageBlock>
</apex:form>
</apex:page>

Accountinputfieldexample

<apex:page standardcontroller="Account">
<apex:form >
<apex:pageBlock title="lookup">
<apex:pageBlockSection >
<apex:inputField value="{!Account.ownerid}"/>
<apex:inputField value="{!Account.parentid}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

Example108

<apex:page standardController="Account">
<apex:form >
<apex:OutputLabel Value="NAme"></apex:OutputLabel><br/><br/><br/>

<apex:inputField value="{!account.name}"/><p/>
   {!$User.FirstName}

    {!$Organization.Name}
<apex:outputText Value="{!account.name}"/>
</apex:form>
</apex:page>

Extensionexample

<apex:page standardController="Account" extensions="SelectPicklist" showHeader="true" sidebar="true">
<apex:form >
<apex:pageBlock title="Page Details">
<apex:pageBlockSection >
<apex:selectList label="Year of Passing" value="{!YearValue}" size="1" multiselect="false" >
<apex:actionSupport event="onchange" action="{!Picklist}"/>
<apex:actionStatus startText="Applying value........">
</apex:actionStatus>
<apex:selectOptions value="{!Yearlist}"/>
</apex:selectList>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:outputPanel id="pd" rendered="{!YearValue1}">
<apex:pageBlock title="2010 Hiding Details">
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Account Name">
</apex:outputLabel>
<apex:inputField value="{!Account.Name}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Account Industry">
</apex:outputLabel>
<apex:inputField value="{!Account.Industry}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
<apex:outputPanel rendered="{!YearValue2}">
<apex:pageBlock title="2011 Hiding Details">
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Account Phone">
</apex:outputLabel>
<apex:inputField value="{!Account.Phone}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Account Type">
</apex:outputLabel>
<apex:inputField value="{!Account.Type}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Account Description">
</apex:outputLabel>
<apex:inputField value="{!Account.Description}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Account Rating">
</apex:outputLabel>
<apex:inputField value="{!Account.Rating}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
</apex:form>
</apex:page>
Extensionsexample

<apex:page standardController="Account" extensions="myControllerExtension">

    {!greeting} <p/>

<apex:form >

<apex:inputField value="{!account.name}"/><p/>

<apex:commandButton value="Save" action="{!save}"/>

</apex:form>

</apex:page>

Extension 2
<apex:page standardController="Account"

  extensions="ExtOne,ExtTwo" showHeader="false">

<apex:outputText value="{!foo}" />

</apex:page>


Inputfieldsexample

<apex:page standardController="Account">
<apex:form >
<apex:pageBlock title="inputfields">
<apex:pageBlockSection >
<apex:inputText value="{!Account.Name}" />
<apex:inputText value="{!Account.Industry}" />
</apex:pageBlockSection>
<apex:pageBlockSection >

<apex:inputField value="{!Account.Name}" />
<apex:inputField value="{!Account.Industry}" />
</apex:pageBlockSection>

</apex:pageBlock>

</apex:form>
</apex:page>
INLINE Edit


<apex:page standardController="Account">
<apex:form >
<apex:pageBlock title="Account Detail">
<apex:inlineEditSupport >
<apex:pageBlockSection title="Account Information" collapsible="false">
<apex:outputField value="{!Account.Name}" />
<apex:outputField value="{!Account.Industry}" />
<apex:outputField value="{!Account.Phone}" />
<apex:outputField value="{!Account.ownerid}" />
</apex:pageBlockSection>
</apex:inlineEditSupport>
</apex:pageBlock>
</apex:form>
</apex:page>
INPUTFIELDEXAMPLE


<apex:page standardController="Account">
<apex:form >
<apex:pageBlock title="inputfields">
<apex:pageBlockSection >
<apex:inputText value="{!Account.Name}" />
<apex:inputText value="{!Account.Industry}" />
</apex:pageBlockSection>
<apex:pageBlockSection >

<apex:inputField value="{!Account.Name}" />
<apex:inputField value="{!Account.Industry}" />
</apex:pageBlockSection>

</apex:pageBlock>

</apex:form>
</apex:page>


Pagereference

<apex:page controller="outputPage2">


{!empname}
{!age}

</apex:page>


INPUTTEXTEXAMPLE


<apex:page controller="InputTextExample">
<apex:form >
<apex:inputText value="{!name}" tabindex="1" />
<apex:inputText value="{!age}"/>
<apex:commandButton value="Submit" action="{!show}" reRender="pb2" />
<apex:pageBlock title="Output" id="pb2">
              {!name}
              {!Age}
</apex:pageBlock>
</apex:form>
</apex:page>


Interviewfifthclass using commandlink seach accountname


<apex:page controller="InterviewFifthClass" sidebar="false" >
<apex:form >
<apex:pageBlock >
<apex:pageMessages />
<apex:sectionHeader title="Select Account Name Section"/>
<apex:pageBlock title="All Accounts">
<apex:pageBlockTable value="{!lstacc}" var="l" >
<apex:column headerValue="AccountName" >
<apex:commandLink value="{!l.name}" action="{!click}"/>
</apex:column>
<apex:column headerValue="Billing State/Province"
value="{!l.BillingState}">
</apex:column>
<apex:column headerValue="phone" value="{!l.phone}">
</apex:column>
<apex:column headerValue="website" value="{!l.website}">
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:pageBlock>
</apex:form>
</apex:page>

javascriptList

<apex:page controller="javascriptList" id="page">

<script>

    function getNo(myid){

         var recid=myid.split(':');

             document.getElementById('page:fm:rno').value=recid[4];

        }

    function show(myid){

          var recid=myid.split(':');

         var price= document.getElementById('page:fm:pb:pbt:'+recid[4]+':price').value;

         var quant=document.getElementById('page:fm:pb:pbt:'+recid[4]+':quant').value;

         var total=price*quant;

         document.getElementById('page:fm:pb:pbt:'+recid[4]+':total').value=total;



        }



</script>

<apex:form id="fm">

<apex:inputHidden value="{!rowno}" id="rno" />

<apex:pageBlock title="Product" id="pb">

<apex:pageBlockTable value="{!products}" var="a" id="pbt" >

<apex:column >

<apex:facet name="header"><apex:inputCheckBox /></apex:facet>

<apex:inputCheckBox value="{!a.flag}" />

</apex:column>

<apex:column headerValue="Product Name">

<apex:inputText value="{!a.name}" id="name"  />

</apex:column>

<apex:column headerValue="Price">

<apex:inputText value="{!a.price}" id="price" onchange="show(this.id)" size="5" />

</apex:column>

<apex:column headerValue="Quantity">

<apex:inputText value="{!a.quant}" id="quant" onchange="show(this.id)" size="5"/>

</apex:column>

<apex:column headerValue="total" >

<apex:inputText id="total"  value="{!a.total}" size="5" />

</apex:column>

<apex:column headerValue="Add|Del">

<apex:commandButton value="add" id="b1" action="{!addRow}"  onclick="getNo(this.id)" />

<apex:commandButton value="del"  id="b2" action="{!removeRow}" onclick="getNo(this.id)"/>

</apex:column>

</apex:pageBlockTable>

<apex:pageBlockButtons location="bottom">

<apex:commandButton value="AddMore" action="{!addMore}" />

<apex:commandButton value="submit" action="{!submit}" />

<apex:commandButton value="DeleteRows" action="{!multipleRows}" />

</apex:pageBlockButtons>

            {!nos}

</apex:pageBlock>

</apex:form>

</apex:page>
JavaScriptExamadd

<apex:page controller="JavaScriptExamadd" id="page">

<script>

    function find(myid){

        var rowid=myid.split(':');

            document.getElementById('page:fm:pb:pbt:'+rowid[4]+':sec').value=rowid[4];

        }

    function show(myid){

        var rowid=myid.split(':');

            var quant=document.getElementById('page:fm:pb:pbt:'+rowid[4]+':quant').value;

            var price=document.getElementById('page:fm:pb:pbt:'+rowid[4]+':price').value;

            var total=quant*price;

            document.getElementById('page:fm:pb:pbt:'+rowid[4]+':total').value=total;

        }

</script>

<apex:form id="fm">

<apex:pageBlock title="Product List" id="pb">

<apex:pageBlockTable value="{!products}" var="a" id="pbt">

<apex:column headerValue="Product Name">

<apex:inputText value="{!a.pname}" id="pname" />

</apex:column>

<apex:column headerValue="Quantity">

<apex:inputText value="{!a.quant}"  size="4" id="quant" onchange="show(this.id)" />

</apex:column>

<apex:column headerValue="Price">

<apex:inputText value="{!a.price}" size="4" id="price" onchange="show(this.id)" />

</apex:column>

<apex:column headerValue="Total">

<apex:inputText value="{!a.total}" id="total" />

</apex:column>

<apex:column headerValue="Action">

<apex:commandButton value="Add"  id="b1" onclick="find(this.id)" action="{!addRow}" />

<apex:commandButton value="Del" id="b2" onclick="find(thid.id)"  action="{!removeRow}"/>

<apex:inputHidden value="{!rowno}" id="sec"/>

</apex:column>

</apex:pageBlockTable>

<apex:pageBlockButtons location="bottom">

<apex:commandButton value="AddMore" action="{!addProducts}"  />

</apex:pageBlockButtons>

</apex:pageBlock>

</apex:form>

</apex:page>

 JAvascript Using FUNCTIONEXAMPLE

<apex:page controller="FuntionExample">
<apex:form id="one">
<script>
     function javafun(){
         callme();
        }
        function javafun2(){
         callme2();
        }


</script>
<apex:actionFunction name="callme" action="{!show}" reRender="one" />
<apex:actionFunction name="callme2" action="{!show2}" reRender="one" />
<apex:commandButton value="click" oncomplete="javafun()" />
        {!result}{!krish}
<apex:commandButton value="click" oncomplete="javafun2()" />
        {!krish}

</apex:form>
</apex:page>

LIST Example
<apex:page controller="ListExample">
<apex:form >
<apex:pageBlock title="List of Name " >
<apex:pageBlockTable value="{!names}" var="a">
<apex:column value="{!a}" />
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title="List of Accounts " >
<apex:pageBlockTable value="{!accs}" var="a">
<apex:column value="{!a.Name}" />
<apex:column value="{!a.industry}" />
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title="List of ProdWrap " >
<apex:pageBlockTable value="{!products}" var="a">
<apex:column >
<apex:facet name="header">
<apex:inputCheckBox />
</apex:facet>
<apex:inputCheckBox value="{!a.flag}"/>
</apex:column>
<apex:column headerValue="Product Name" >
<apex:inputText value="{!a.name}" />
</apex:column>
<apex:column headerValue="Quantity" >
<apex:inputText value="{!a.quant}" />
</apex:column>
<apex:column headerValue="Price" >
<apex:inputText value="{!a.price}" />
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockButtons location="Bottom">
<apex:commandButton value="Submit" action="{!getValues}"  />
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock title="List of ProdWrap "  rendered="{! !ISNULL(selected)}"  id="one" >
<apex:pageBlockTable value="{!selected}" var="a">
<apex:column headerValue="Product Name" >
<apex:outputText value="{!a.name}" />
</apex:column>
<apex:column headerValue="Quantity" >
<apex:outputText value="{!a.quant}" />
</apex:column>
<apex:column headerValue="Price" >
<apex:outputText value="{!a.price}" />
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

MULTIUPLOADS FILES

<apex:page standardController="Account" extensions="MultipleUploadController">
<apex:form >
<apex:pageBlock title="Upload Multiple Attachment to Object">

<apex:pageBlockButtons >
<apex:commandButton value="Upload"  action="{!SaveAttachments}"/>
</apex:pageBlockButtons>

<apex:pageMessages id="MSG"/>
<apex:actionFunction name="ChangeCount" action="{!ChangeCount}"/>

<apex:pageblocksection >

<apex:pageBlockSectionItem >
<apex:outputLabel value="How many files you want to upload?"/>
<apex:selectList onchange="ChangeCount() ;" multiselect="false" size="1" value="{!FileCount}">
<apex:selectOption itemLabel="--None--" itemValue=""/>
<apex:selectOptions value="{!filesCountList}"/>
</apex:selectList>
</apex:pageBlockSectionItem>

</apex:pageblocksection>

<apex:pageBlockSection title="Select Files" rendered="{!IF(FileCount != null && FileCount != '', true , false)}">
<apex:repeat value="{!allFileList}" var="AFL">
<apex:inputfile value="{!AFL.body}" filename="{!AFL.Name}" />


</apex:repeat>
</apex:pageBlockSection>

</apex:pageBlock>
</apex:form>
</apex:page>
Multiselect Cities

<apex:page controller="MultiSelectExample">
<apex:form >
<apex:pageBlock id="one">
<apex:panelGrid columns="3">
<apex:selectList value="{!selected}" multiselect="true" style="width:80px;height:80px;" >
<apex:selectOptions value="{!nsoptions}" />
</apex:selectList>
<apex:panelGrid columns="1">
<apex:commandButton value="Add"  action="{!addEle}" reRender="one"/>
<br/><br/>
<apex:commandButton value="Del"  action="{!removeEle}" reRender="one"/>
</apex:panelGrid>
<apex:selectList value="{!removed}" multiselect="true" style="width:80px;height:80px;" >
<apex:selectOptions value="{!soptions}" />
</apex:selectList>
</apex:panelGrid>
</apex:pageBlock>
</apex:form>

</apex:page>

OUTPUT COMPONENTS

<apex:page standardController="Account">
<apex:form >
<apex:pageBlock title="Account Record" tabStyle="Customer__c">
<apex:inlineEditSupport >
<apex:pageBlockSection title="OutputLabel" collapsible="false" >
<apex:outputLabel value="{!Account.Name}" />
<apex:outputLabel value="{!Account.Industry}" />
</apex:pageBlockSection>
<apex:pageBlockSection title="OutputText" collapsible="false">
<apex:outputText value="{!Account.Name}" />
<apex:outputText value="{!Account.Industry}" />
</apex:pageBlockSection>
<apex:pageBlockSection title="OutputFields" collapsible="false">
<apex:outputField value="{!Account.Name}" />
<apex:outputField value="{!Account.Industry}" />
</apex:pageBlockSection>
</apex:inlineEditSupport>
</apex:pageBlock>
</apex:form>
</apex:page>


OUTPUT FILEDS AND OUTPUT TESTS
<apex:page standardcontroller="Account">
<apex:form >
<apex:pageBlock title="accountpage">
<apex:pageBlockSection title="Account Section outputtext" >
<apex:outputText value="{!Account.Name}"/>
<apex:outputText value="{!Account.Industry}" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Account Section output field" >
<apex:outputField value="{!Account.Name}"/>
<apex:outputField value="{!Account.Industry}" />
</apex:pageBlockSection>

<apex:pageBlockSection title="Account Section inline edit " >
<apex:inlineEditSupport >
<apex:outputText value="{!Account.Name}"/>
<apex:outputText value="{!Account.Industry}" />
<apex:outputField value="{!Account.Name}"/>

<apex:outputField value="{!Account.Industry}" />
</apex:inlineEditSupport>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
PAGE MESSAGES

<apex:page controller="Messges">
<apex:pagemessages />
</apex:page>

PAGE REFERENCE 1
<apex:page controller="InputPage1">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Enter Name" />
<apex:inputText value="{!name}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Enter Age" />
<apex:inputText value="{!age}" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:commandButton value="Next" action="{!show}"/>
</apex:pageBlock>
</apex:form>
</apex:page>
PARAMETER EXAMPLE


<apex:page controller="aaPage52">
<apex:form id="RID">
<apex:commandButton value="click" action="{!TestX}" rerender="RID">
<apex:param name="X" value="{!X + 1}" />
           //<apex:param assignTo="{!X}"  value="{!X + 1}" />
</apex:commandButton>
<apex:outputText value="{!X}"/><br/>

<apex:commandButton value="click" action="{!TestX2}" rerender="RID">
<apex:param assignTo="{!X2}" value="{!X2 + 1}" />
</apex:commandButton>
<apex:outputText value="{!X2}"/><br/>

</apex:form>
</apex:page>

PARAMETER VF TO APEX USING EXTENSION

<apex:page standardController="Account" extensions="ParamBlogController">
<apex:outputPanel id="all">
<apex:form >
<apex:pageBlock title="Account Detail">
<apex:pageBlockSection title="Account">
<apex:outputField value="{!Account.Name}"/>
<apex:outputField value="{!Account.Description}"/>



</apex:pageBlockSection>
<apex:pageBlockSection title="Contacts" columns="1">
<apex:pageBlockTable value="{!conts}" var="cont" rows="10">
<apex:column value="{!cont.Id}"/>
<apex:column value="{!cont.Name}"/>
<apex:column value="{!cont.Email}"/>
<apex:column value="{!cont.Phone}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:outputPanel>
</apex:page>
PASS PARAMETER WITHOUT PAGEREFERENCE

<apex:page controller="WithoutPageReference" tabStyle="Opportunity">
<apex:form >
<apex:pageBlock title="Opportunity Detail">
<apex:pageBlockButtons >
<apex:commandButton value="Save The Opportunity" action="{!saveMethod}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Opportunity Information" columns="2"
 collapsible="false">
<apex:inputField value="{!Opportunity .Name}"/>
<apex:inputField value="{!Opportunity .DeliveryInstallationStatus__c}"/>
<apex:inputField value="{!Opportunity .TrackingNumber__c}"/>
<apex:inputField value="{!Opportunity .CloseDate}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>

</apex:page>

====================================

PICK EXAMPLE USING SLELECTOPTION

<apex:page controller="PickExample">
<apex:form >
<apex:pageBlock title="PickList">
<apex:outputLabel value="Cities" />
<apex:selectList size="1" value="{!selected}" >
<apex:selectOptions value="{!options}" />
<apex:actionSupport event="onchange" action="{!selectedmethod}" reRender="res" />
</apex:selectList>
<apex:outputLabel value="{!result}" id="res" />
</apex:pageBlock>
</apex:form>
</apex:page>

<apex:page Sidebar="False" Setup="False">
<apex:pageMessage summary="This is a pageMessage"
    severity="warning" strength="3"/>
</apex:page>
Practice insert on objects

<apex:page StandardController="Practice__c">
<apex:form >
<apex:PageBlock Title="new" >


<apex:pageBlockButtons >

<apex:commandButton action="{!save}" value="Save"/>

</apex:pageBlockButtons>

<apex:pageBlockSection title="My Content Section" columns="2">

<apex:inputField value="{!Practice__c.Country__c}"/>
<apex:inputField value="{!Practice__c.Newjob__c}"/>



</apex:pageBlockSection>
</apex:PageBlock>
</apex:form>
</apex:page>
Product wrapper with cost code

<apex:page controller="ProductList" >
<apex:form >
<apex:pageBlock title="Products">
<apex:pageBlockButtons >
<apex:commandBUtton value="Clear" action="{!clearAll}" />
<apex:commandButton value="AddMore" action="{!addMore}" />
<apex:commandButton value="Submit" action="{!submit}"  />
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!products}" var="a">
<apex:column >
<apex:inputText value="{!a.name}" />
</apex:column>
<apex:column >
<apex:inputText value="{!a.price}" />
</apex:column>
<apex:column >
<apex:inputText value="{!a.code}" />
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title="Products selected" rendered="{! !ISNULL(mylist)}">
<apex:pageBlockTable value="{!mylist}" var="a">
<apex:column value="{!a.name}" />
<apex:column value="{!a.price}"   />
<apex:column value="{!a.code}" />
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

Registration using javascript

Cutomobject insert data using javascript in vf page



<apex:page standardController="Registration__c" id="page">
<script>
function check(){
var pswd = document.getElementById('page:form:pb:pbs:pswd').value;
var rpswd = document.getElementById('page:form:pb:pbs:rpswd').value;
if(pswd != rpswd){
alert('Passwords do not match.. Please check your passwords');
return false;
}
}
</script>
<apex:form id="form" >
<apex:sectionheader title="Registration Edit" subtitle="New Registration" help="http://www.google.com"/>
<apex:pageblock title="Registration Edit" id="pb">
<apex:pageblocksection columns="1" id="pbs" title="Information" collapsible="false">
<apex:inputField value="{!Registration__c.First_Name__c}"/>
<apex:inputField value="{!Registration__c.Last_Name__c}"/>
<apex:inputField value="{!Registration__c.Email__c}"/>
<apex:inputField value="{!Registration__c.Mobile__c}"/>
<apex:inputField value="{!Registration__c.Username__c}"/>
<apex:inputSecret value="{!Registration__c.Password__c}" id="pswd"/>
<apex:inputSecret label="Retype Password" id="rpswd"/>
</apex:pageblocksection>

<apex:pageblockbuttons >
<apex:commandbutton value="Register" action="{!save}" onclick=" return check()"/>
<apex:commandbutton value="Cancel" action="{!cancel}"/>
</apex:pageblockbuttons>
</apex:pageblock>

</apex:form>

</apex:page>

REPEAT FUNCTION


<apex:page controller="repeatCon" id="thePage">



<apex:repeat value="{!strings}" var="string" id="theRepeat">



<apex:outputText value="{!string}" id="theValue"/><br/>



</apex:repeat>



</apex:page>

SAMPLE CLASS

<apex:page controller="sampleclass">
<apex:pageBlock title="values">
    value={!a}<br/>
    value={!b}
         value={!call}
</apex:pageBlock>
</apex:page>


SAMPLE FIELDS inserting


<apex:page standardController="Opportunity" tabStyle="Opportunity">

<apex:form >
<apex:pageBlock >

<apex:pageBlockSection title="Opportunity Information">

<apex:outputField value="{!opportunity.name}"/>



<apex:outputField value="{!opportunity.amount}"/>

<apex:outputField value="{!opportunity.closeDate}"/>

</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:inputField value="{!opportunity.name}"/>
<apex:inputText value="{!opportunity.name}"/>
</apex:pageBlockSection>

<apex:pageBlockSection title="outputtest and inputtext">
<apex:outputLabel value="Opp Name"></apex:outputLabel>
<apex:inputText />

</apex:pageBlockSection>

</apex:pageBlock>
</apex:form>
</apex:page>


 
SAMPLE SOQL
 
 
 
<apex:page controller="SampleSoql">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
 
<apex:inputText value="{!Searched}"/>
<apex:commandButton value="Submit" Action="{!Submit}"/>
<apex:pageBlockTable value="{!accs}" var="a">
<apex:column Value="{!a.Name}"></apex:column>
<apex:column Value="{!a.Industry}"></apex:column>
 
</apex:pageBlockTable>
 
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
 

2

<apex:page controller="samplesoql2">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
 
<apex:inputText value="{!Searched}"/>
<apex:commandButton value="Submit" Action="{!Submit}"/>
<apex:pageBlockTable value="{!cons}" var="a">
<apex:column Value="{!a.Owner}"></apex:column>
 
</apex:pageBlockTable>
 
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>