Sunday, 30 December 2012

Some Issues:-

--> How to call a component from VF page.

    <c:ComponentName/>



How to insert a field(record) into object from Vf Page.

VF page:-
----
<apex:page controller="commentspage" showHeader="false" sidebar="false" showChat="false" standardStylesheets="false" >
  <apex:form > <br/><br/>
        <div align="center">
         <apex:inputTextarea value="{!CommentText}"/><br/><br/>
         <apex:commandButton value="Save" action="{!save}"/>
        </div>
  </apex:form>
</apex:page>

Apex class
--------
public class commentspage {
    public String CommentText{get;set;}
    Comments__c comm=new Comments__c();
     public void save() {
        comm.Comments_Text__c=CommentText;
        insert comm;
    }
}




-->How to Print Radio buttons list in vertical formate.

<apex:selectRadio id="typical" onclick="alert(this.value);" layout="pageDirection"> <br/>
            <apex:selectOption itemValue="0" itemLabel="Increasing Revenue" />
            <apex:selectOption itemValue="1" itemLabel="Reducing Costs" />
            <apex:selectOption itemValue="2" itemLabel="Reducing Time, Effort or Cycles for Employees" />
            <apex:selectOption itemValue="3" itemLabel="Reducing Time, Effort or Cycles for Assets" />
            <apex:selectOption itemValue="4" itemLabel="Reducing RIsk" />
   </apex:selectRadio>

 
Here Layout=”pageDirection” prints in Vertical formate.
Alert(this.value) gives the alert box popup without.
 


è  -->How To make the radio buttons by default true.


We have to mention the lable value on constructor. like see below code.

Vf page:-
    <apex:selectRadio value="{!etime}" layout="pagedirection">
                <apex:selectOptions value="{!etimeslot}"/>
    </apex:selectRadio><p/>
Apex class:-
             public with sharing class Test5 {
     public String etime{get;set;}
     public Test5(ApexPages.StandardController controller) {
        etime='0.30';
    }
public List<SelectOption> getetimeslot() {
         List<selectOption> options = new List<selectOption>();
             options.add(new selectOption('0.30','Half-An-Hour'));
             options.add(new selectOption('1.0','One-Hour'));
         return options;
    } 
                }





No comments:

Post a Comment