• SFDC_Learner
  • NEWBIE
  • 455 Points
  • Member since 2011

  • Chatter
    Feed
  • 17
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 150
    Questions
  • 223
    Replies

If I wanted to have some sort of button on a record in salesforce, and when I pushed it it would make a call out to another database and retrieve a document and attach it to the record in salesforce - is there a way to do that? Can someone point me in the right direction?

 

Thanks!

Whats the best way to get 

 

Map<String,id> accountNameVsId = [Select id, Accountname form account];

 

Please suggest

HI all, i have scenario like,1 custom object and 2 custom fields i.e. username_c and password__c so i am storing the password in custom object. so what i want is ,whatever storing the password in custom object that wants to be return by using apex class.i was tring to return but i am not getting so pls relsove this issue.but i am not using any vf page. public with sharing class Sample { public static string registerUser() { List obj = new List(); obj = [Select Username__c,Password__c from Login__c where Username__c =:id Limit 1]; return password__c; } THnaks

Hi

 

   What is the  Difference between Standard Controllers & Standard List Controllers .

 

Thanks

I can't find the option to create the sandbox enviroment in the setup console.do we need to contact salesforce to create the sandbox enviroment? and how to refresh the production to the sandbox enviromnet?

 

Thanks

  • August 16, 2011
  • Like
  • 0

I am writing a datatable that contains data of an Object and I have added one more column that with checkbox in each row... when I submit a button I want to get the rows of selected checkboxes... Can you please tell me how to get this

  • July 18, 2011
  • Like
  • 0

Please solve this HTML problem...

How to make the following design...

yfrog.com/keji9qp

I tried this to make it by Table but nt getting proper design so please solve it....

Hello,

 

I have a formula field that produces text.

When I export the object, it doesn't export formula fields.

I would like to export the literal value of the formula field (i.e.: if it produces 'ABCD',

this value should be exported in the *.CVS file).

 

Is there a way to do it?

Is there perhaps an administrative utility that converts the data to text?

 

       Thanks,

 

                aqueller

Hi

I am working on Custom lookup added multi rows when I clicked on "ADD" button.

I am able to work for first row, because I am assigning the value in javascript based on VF element Id.

But I need to do the same for multi lines, then finally for all the rows I need to collect the list of data to do DML.

Below are the sample I have written, but not able to complete the rest.

Please suggest me / send me your thoughts to do it.

Page1:

<apex:page controller="MultiLineCls" cache="true" id="pg">
    <script>
        function showpopup123(){
           var value1=window.showModalDialog('/apex/page2', '','dialogHeight=800px;dialogWidth=800px');
           document.getElementById('pg:fm:j_id2:0:name').value=value1;
          return false;
        }
    </script>
  <apex:form id="fm">
      <table>
           <apex:repeat value="{!lstC}" var="c">
              <tr><td><apex:inputtext value="{!c.lastName}" id="name"/></td><td>
                  <apex:commandLink >
                              <img src="/s.gif" alt="Parent Account Lookup (New Window)" class="lookupIcon" onblur="this.className = 'lookupIcon';" onfocus="this.className = 'lookupIconOn';" onmouseout="this.className =
   
    'lookupIcon';this.className = 'lookupIcon';" onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" title="Parent Account Lookup (New Window)" onclick="return showpopup123();"/>
                  </apex:commandLink>
                  </td>
              </tr>
           </apex:repeat>
      </table>
      <apex:commandButton value="ADD" action="{!doADD}" rerender="fm"/>
  </apex:form>
</apex:page>

Controller for the above Page:

public class MultiLineCls{
    public List<Contact> lstC{get;set;}
    public String lkupVal{get;set;}
    public MultiLineCls(){
        lstC = new List<Contact>();
        lstC.add(new Contact());
    }
   
    public pagereference doADD(){
       
        lstC.add(new Contact());
        return null;
    }
}



Lookup Page (page2)

<apex:page controller="GetAccounts" wizard="true">
    <script>
        function sendacc(accName,accId)
        {
            window.returnValue = accName+"#"+accId;
            self.close();
        }
    </script>
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!accs}" var="a">
                <apex:column headerValue="Account">
                    <a value="{!a.name}" onclick="sendacc('{!a.name}','{!a.Id}')">{!a.name}</a>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>


Thank you.
Dear all,



http://maps.googleapis.com/maps/api/geocode/xml?latlng=77.4439,17.4368&sensor=false

I am using this end point url to find the street, city, state, zip code and Country by passing longitude and latitude in Apex.

But I guess the address that is showing in the response is not the correct one. I heard that there are two different north and south..... 

Can you guide me what is the best end point url to identify the location (street, city, state, zip and country) using longitude and latitude. If you have end point url plz share to me.

Anybody worked on this?

page:

 

<script>
function deleteEmployee(EId){
var res = confirm('Are you sure?');
if(res == true){
doexecute(EId);
}
}
</script>
<apex:form >
<apex:actionfunction name="doexecute" action="{!doDelete}" rerender="pb">
<apex:param name="empId" value="" assignTo="{!employeeId}"/>
</apex:actionfunction>

<apex:outputpanel id="pb">
<apex:pageBlock >
<apex:pageBlockTable value="{!lstE}" var="E">
<apex:column headerValue="Action">
<apex:commandlink value="Del" onclick="deleteEmployee('{!E.Id}')" rerender="pb">
</apex:commandlink>
</apex:column>
<apex:column headerValue="Employee Name" value="{!E.Name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:outputpanel>

 

 

class:

 

public String employeeId{get;set;}
public void doDelete() {
delete [select id from Employee__c where id =: employeeId];
}


public List<Employee__c> lstE{get;set;}
public AccDataclass(){
lstE = new List<Employee__c>();
lstE = [select id,name from Employee__c];
}

 

 

 

Once i deleted a record then the  pageblock table is not updated. It still showing the deleted records also. When i am refreshing the browser it clears the deleted records.

 

Any Idea!

Hi

 

Apex Sharing Class:

 

public with sharing class TestCls {

    public TestCls(){

         myweb.dologic();

   }

}

 

=====

// Webservice class

 

Global class className{

    dologic();

}

 

 

 

In this case What is the apex code execution mode. is it in user / system?

 

 

Because all webservices will execute in system mode. But sharing class will execute in user mode.

 

When we call a webservice method from sharing class.. what is the final execution mode?

Hi

 

I am using following Code.

 

<apex:page sidebar="false">
<apex:form >
<apex:tabPanel >
<apex:tab title="Tab1">
Tab1
</apex:tab>
<apex:tab title="Tab2">
Tab2
</apex:tab>
</apex:tabPanel>
<c:VFAttachmentSlider RecordId="a0190000007m4ys"/>
</apex:form>
</apex:page>

 

 

 

In "VFAttachmentSlider" Component i have included few jQuery releated files to design slider. When i am commecting those Jquery libraries then tabs are working fine. When i use jQuery then tabs are not working..

 

Any ideas!

How can i show the show or hide for the individual sections.. not for all.

 

page:

 

<apex:page controller="questionsClass">
<apex:form >
<apex:actionfunction name="showAnswer" action="{!showAnswer}" rerender="out1"/>
<apex:actionfunction name="hideAnswer" action="{!hideAnswer}" rerender="out1"/>

<!--
<apex:commandLink value="Expand" action="{!showAnswer}" reRender="out1"/> | &nbsp;
<apex:commandLink value="Collapse" action="{!hideAnswer}" rerender="out1"/>
-->

<apex:outputpanel id="out1">
<table>
<tr height="20px;">
</tr>
<apex:repeat value="{!lstQC}" var="QC">
<tr>
<td>
<apex:image value="{!$Resource.plus}" onclick="showAnswer();" rendered="{!plusimg}"/>
<apex:image value="{!$Resource.minus}" onclick="hideAnswer();" rendered="{!minusimg}"/>
</td>
<td>
<apex:outputtext value="{!QC.q}" style="font-size:15px;font-weight:bold;color:red;"/>
</td>
</tr>
<tr >
<td>
</td>
<td >
<apex:outputtext value="{!QC.a}" style="margin-left:50px;color:green;" rendered="{!expandedval}"/>
</td>
</tr>
</apex:repeat>
</table>
</apex:outputpanel>
</apex:form>
</apex:page>

 

 

class:

 

public with sharing class questionsClass {

public void hideAnswer() {
expandedval = false;
minusimg = false;
plusimg = true;

}

public void showAnswer() {
expandedval = true;
minusimg = true;
plusimg = false;
}


public boolean minusimg { get; set; }
public boolean plusimg { get; set; }
public boolean expandedval { get; set; }
public List<Q_A__c> lstqa{get;set;}
public List<QuesClass> lstQC{get;set;}
public questionsClass(){
expandedval = false;
plusimg = true;
minusimg = false;
lstqa = new List<Q_A__c>();
lstqa = [select id,name,answer__c from Q_A__c];
lstQC = new List<QuesClass>();
for(Integer i=0;i<lstqa.size();i++){
QuesClass objQC = new QuesClass();
objQC.q = lstqa[i].Name;
objQC.a = lstqa[i].answer__c;
lstQC.add(objQC);
}
}

public class QuesClass{
public String q{get;set;}
public String a{get;set;}
}
}

 

 

Once i clicked on + for any record it was expanding all sections... But not the specific one.

 

I need to show only the specific section that i clicked.

 

Can you help me.

Hi

 

Here 

"wrapperList" is a list of wrapper data.

 

 

<apex:attribute name="d1" assignto="{!wrapperList}" type="outerclass.Innerwrap[]" description="Data to pass"/>

 

 

how can i pass wrapper list to the type.

Hi,

 

I dont know whether it is possible or not.

 

I have two components and a page.

 

I am using components in a page and rendering the second component.

 

But the second component is not rendering properly.

 

Any Idea!

 

VF Page Code:

 
<apex:page >
  <apex:form >
          <apex:outputpanel id="op1">
               <c:VCContacts ></c:VCContacts>
          </apex:outputpanel>
          
          
          <apex:outputpanel id="op2">
              <apex:actionstatus id="mystatus" startText="loading....">
                  <apex:facet name="stop" >
                      <c:VCConSelect ></c:VCConSelect>
                  </apex:facet>
              </apex:actionstatus>
          </apex:outputpanel>
 
   </apex:form>
</apex:page>
 
 
 
 
********************************
Component1 (VCContacts):
 
 
 
Code:
 
<apex:component controller="ContactsDisplayClass">
  <apex:pageBlock >
      <apex:pageBlockTable value="{!lstWC}" var="wc">
        <apex:column headerValue="Action">
            <apex:inputcheckbox value="{!wc.ischecked}"/>
        </apex:column>
        <apex:column headerValue="Name" value="{!wc.objC.name}"/>
      </apex:pageBlockTable>
      <apex:commandButton value="ShowSelected" action="{!doShow}" reRender="op2" status="mystatus"/>
  </apex:pageBlock>
</apex:component>
 
 
 
*******************************
Component2 (VCConSelect)
 
Code:
 
<apex:component controller="ContactsDisplayClass">
            <apex:pageBlock >
                  <apex:pageBlockTable value="{!selContacts}" var="sc">
                          <apex:column headerValue="Name" value="{!sc.Name}"/>
                  </apex:pageBlockTable>
              </apex:pageBlock>
</apex:component>
 
 
*******************
Common Controller for both Components:
 
 
Controller code:
 
public with sharing class ContactsDisplayClass {
    public List<String> conIds = new List<String>();
    public void doShow() {
        for(wrapContactcs objWC : lstWC){
            if(objWC.ischecked == true){
                conIds.add(objWC.objC.Id);
            }
        }
        selContacts = new List<contact>();
        selContacts = [select id,name from Contact where ID IN : conIds];
        system.debug('--selContacts are -->'+selContacts);
    }
 
    public List<Contact> selContacts{get;set;}
    public List<Contact> lstC{get;set;}
    public List<wrapContactcs> lstWC{get;set;}
 
    public ContactsDisplayClass(){
        lstC = new List<Contact>();
        lstC = [select id,name,AccountId from Contact where AccountId =: apexPages.currentpage().getParameters().get('id')];
        lstWC = new List<wrapContactcs>();
        
        for(Contact objC : lstC){
            wrapContactcs objWC = new wrapContactcs();
            objWC.objC = objC;
            lstWC.add(objWC);
        }
    }
    
    public class wrapContactcs{
        public boolean ischecked{get;set;}
        public Contact objC{get;set;}
    }
}
 
 

 

 

<apex:page id="p1">
    <apex:includeScript value="{!$Resource.jQueryFile}"/>
 
    <input type="button" value="welcome" id="txt1"/> 
    <apex:outputText value="hello, good morning" id="txt2" rendered="false"></apex:outputText>
    
     <script>
     $(document).ready(function() {
        test();
     });
 
     $('#txt1').click(function() {
         // alert(document.getElementById('txt2').value);
         alert('hello');
      });
       
           
     </script>
</apex:page>
 
 
 
Q : Why this statement is showing : Undefined ( // alert(document.getElementById('txt2').value);)

Hi

 
Im querying list of records from an object with fields Name,value1__c,value2__c.
 
I m not using any wrapper class to build this list.
 
and displayed all the data in pageblock table.
 
Here i need to add one more column to the existing pageblock table there i want to add the value1__c and value2__c and want to show in a new field.
 
 
When i am adding this with a merge field these two values are going to concate instead of addition like below
 
10 20 10+20
 
But i want
 
10 20 30
 
 
Any idea!

Hi

 

I am using <apex:repeat> including a wrapper list to bind in the table tr and tds.

 

when the page is rendering as pdf then the repeater is not showing any list.

 

Any Idea!

Hi I have created a component with a specific format.

 

And i generated a pdf that contains 10 pages.

 

How can i attach my component as a footer to all the pages in the PDF?

 

 

I tried different samples from google, and could not find this.

When i click on "Yes" radio i need to show the section that is having required field. When im clicking on "No" i need to hide the section.  But it is working fine when i click on "Yes" and when i click on "No" the required field asking a value.

 
Can you pleae correct the code :
 
 
Page:
 
<apex:page controller="SelectRadioclass" id="p1">
    <script>
        function InvoiceAddr(){
            alert('hi');
            document.getElementById('p1:f1:btnsearchforlonglat').click();  
        }
    </script>
 
      <apex:form id="f1">
          <apex:SelectRadio value="{!AddressOption}" onclick="InvoiceAddr();" >
                <apex:selectOptions value="{!yesno}"/>  
          </apex:SelectRadio>
 
      
      <apex:actionFunction name="test" action="{!InvoiceAddress}" /> 
     <apex:commandButton value="test" id="btnsearchforlonglat"  onclick="test();" immediate="true"  style="display:none;" />
           
     
      <apex:pageblock >
          <apex:pageblockSection title="Billing Address" rendered="{!BillingBool}" >
                                    <apex:inputField value="{!Acct.ShippingCity}" required="true"/>  
                    </apex:pageblockSection> 
       </apex:pageblock>
            
     </apex:form>
</apex:page>
 
 
class:
 
 
public with sharing class SelectRadioclass {
 
    public pagereference InvoiceAddress(){
               system.debug('---entered--');
                if(AddressOption == 'true'){
                    system.debug('---true--');
                     BillingBool = true;
                }else{ 
                          system.debug('---false--');
                          BillingBool = false;
                }
                return null;
       }              
               
 
               
 
 
    public boolean BillingBool { get; set; }
    public Account Acct{get;set;}
    
    public SelectRadioclass(){
        acct = new Account();
    }
     public List<SelectOption> getYesNo() {
                List<SelectOption> options = new List<SelectOption>();
                 options.add(new SelectOption('true', 'Yes'));
                 options.add(new SelectOption('false', 'No'));
                 
                return options;
                  }
 
 
    public String AddressOption { get; set; }
}

HI

 

I am calling a class from trigger and class has below statements.

 

PageReference pageref=new PageReference('https://test.abcd.xyz.force.com/abcd/apex/forcetest?id=xxxxxxxxxxxxxxx');
pageref.setRedirect(true);
Blob b=pageref.getContentAsPDF();

 

and I have another page with name 'forcetest'. I am passing id from this class to 'forcetest' visual force page later i do renderas PDF. But when im doing this i could generate a pdf but not able to get the id in 'forcetest' page  related controller.

 

Any Idea!

HI

 

I am working with multi colored bar charts.

 

I have 5 fields, and get a list throuth wrapper and displayed in <apex:chart/> and working fine.

 

Questions is,

 

<apex:barSeries title="R1,R2,R3,R4,R5" orientation="horizontal" axis="bottom"  xField="data,data1,data2,data3,data4" yField="name" colorSet="blue,Magenta,Yellow,LightSeaGreen,cyan" stacked="true">
      <apex:chartTips height="20" width="120"/>
 </apex:barSeries> 
 
 
In above code, How can i add a  dynamic color for the values based on filter... 
 
For ex, 
IF(R1>0 && R1 <=10) : Color should be red
IF(R!>10 && R1<=20) : Color should be green  .. etc
 
like this based on a specific criteria i want to add a color value in colorSet.
 
In General we can bind the IF() in "Style" tags and then we can apply the conditions accordingly.
But here barseries is not having a "Style" tag to do this.
 
Any Idea!
 
 
Thank you

HI

 

Need a CSS that helps to make a sample HTML table with pageblock table in look and feel.

 

 

Thank you

Hi

 

How to write a legend (CSS) to each td in a table?

 

---------Name---------City------------Country------------

|           Ajay       |      Pune       |         Ind                      |

--------Count---------------------------Value---------------

|           10          |      Test       |         2536                    |

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

|           10          |      Test       |         2536                    |

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

 

 Like the above i need a legend css to the td tag where ever i need?

  

 

Thanks

 

 

 

Hi

 

I used below css to get the landscape page and it is renderedAs PDF.

 

<head>
<style>
@page{
size:landscape;
}
</style>
</head>

 

The same code worked fine long ago. Now its not working.

 

Can you let me know, what reasons may cause this?

 

 

Hi I have written an apex class to Parse XML String.

 

Page is :

 

<apex:page controller="XMLParseClass">
<apex:form >
<apex:pageblock >
<apex:pageblocksection >
<apex:inputfile value="{!objD.body}" filename="{!objD.name}"></apex:inputfile>
<apex:commandButton value="Parse" action="{!doParse}"/>
</apex:pageblocksection>

<apex:pageblocktable value="{!lstW}" var="w">
<apex:column headerValue="Emp Name" value="{!w.empName}"/>
<apex:column headerValue="Emp Id" value="{!w.empId}"/>
<apex:column headerValue="Emp City" value="{!w.empCity}"/>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>

 

 

class is :

 

 

public with sharing class XMLParseClass {

public Document objD {get;set;}

public void doParse(){

}

public List<Wrapper> lstW{get;set;}
public XMLParseClass(){
objD = new Document();
List<STring> lstvalues = new List<String>();
//String xml = objD.body.toString();
String xml ='<Company><Department><Employee><Name>A1</Name><EmpId>001</EmpId><city>Hyd</city></Employee><Employee><Name>A2</Name><EmpId>002</EmpId><city>Banglore</city></Employee><Employee><Name>A3</Name><EmpId>003</EmpId><city>Chennai</city></Employee></Department></Company>';
system.debug('--xml is -->'+xml);
Dom.Document doc = new Dom.Document();
doc.load(xml);

for(DOM.XMLNode rootnode : doc.getRootElement().getChildElements()){
for(DOM.XMLNode dept: rootnode.getChildElements()){

for(DOM.XMLNode Emp: dept.getChildElements()){
lstValues.add(Emp.getText()); // In this line, we can write the code to get the data and can build wrapper list. But i could not build this. Instead of this, i have written a code using for loop (as i selected below)
}
}
}
List<STring> names = new List<String>();
List<STring> Ids = new List<String>();
List<STring> Cities = new List<String>();
for(Integer i=0;i<lstValues.size();i+=3){
names.add(lstValues[i]);
}
for(Integer i=1;i<lstValues.size();i+=3){
Ids.add(lstValues[i]);
}
for(Integer i=2;i<lstValues.size();i+=3){
cities.add(lstValues[i]);
}
lstW = new List<wrapper>();
wrapper objW = new wrapper();
for(Integer i=0;i<Ids.size();i++){
objW = new wrapper();
objW.empName = names[i];
objW.empId = Ids[i];
objW.empCity = cities[i];
lstW.add(objW);
}
system.debug('---lstW is --->'+lstW);
}

public class wrapper{
public String empName{get;set;}
public String empId{get;set;}
public String empcity{get;set;}
}
}

 

 

 

Here in this class i feel that, we can optimize the code.

 

The Red colored code can be optimized and can easily build a wrapper list.

 

Can you help me to optimize the above code..

 

Hi,

 

 

How to get a map<id,String> for RecordType using Described Information.

 

i.e I want to get the RecordTypeId,RecordTypeName map without query and wants to get it through described call?

 

Is this possible?

Hi Guys,

 

In Opportunity Object for some page layouts in my organization in record detail page the field lable is "Closedate" when i edit the same layout the same field label is like "Expected close date". How this happens?

 

Is it depends on any other settings or open / closed status of an opportunity? or any other ?

 

 

HI,

 

To give permissions (create,edit,delete,view)on a particular object we use profiles.

But in sharing settings sections we can find the feature called organization wide default. Here we can give the public readonly, public read/write ..... permissions. 

 

what is the difference between these profile based and organization wide default permissions?

I observed that, profile will overides org wide default permissions. is it right? if it is correct then  which situation we use the org wide default settings for an org once we have profile permissions?

 

 

please clarify this

 

 

 

 

Hi ,

 

Please help me to write a test class for the below batch class written,

 

global class logdeletion implements Database.Batchable<sObject>{
    public String query{get;set;}
    public String email{get;set;}
    //public Id toUserId{get;set;}
   // public Id fromUserId{get;set;}
    
    global Database.querylocator start(Database.BatchableContext BC){
        return Database.getQueryLocator('Select Comments__c,Name,Owner,CreatedBy,LastModifiedBy,Date_TimeStamp__c,isSuccess__c,Report_URL__c,Result_String__c,Sample_Id__c,Sample_Stage__c FROM Log__c' );
    }
    
    global void execute(Database.BatchableContext BC, List<sObject> scope){
        List<Log__c> Logs = new List<Log__c>();
        
        for(sObject s : scope){
            Log__c a = (Log__c)s;
            
        }        
        delete Logs ;   
        //system.debug('batch apex called'+accns);     
    }
    global void finish(Database.BatchableContext BC){
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        
        mail.setToAddresses(new String[] {email});
        mail.setReplyTo('test@test.com');
        //mail.setSenderDisplayName('SFDC Developer Organization');
        //mail.setSubject('Batch Process');
        //mail.setPlainTextBody('Batch Process has completed');
        
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
    }

 

 


}Thanks

Hi,

 

I'm having problem with this approach for creating invoiceLineItems, ultimately this is giving me an error saying that System.ListException: Before Insert or Upsert list must not have two identically equal elements..

now bellow is the code. if any one has any of the solutions that plz let me know.

          

 

       for(opportunityLineItem olis : opportunityLineItems)

                            Date WeekStartDate = olis.StartDate__c.date();
                            Date WeekEndDate = olis.EndDate__c.date();
                            Interval = startDate.daysBetween(endDate) / 7;
                          
                            if(interval == 0){
                               interval = 1;
                            }
                           
                           
                            for(integer i = 0; i < interval; i++){
                                InvoiceLineItem__c invoiceLineItem = new InvoiceLineItem__c();
                                if(interval > 1){
                                    invoiceLineItem.StartDate__c = WeekStartDate.addDays(sdays1);
                                    invoiceLineItem.EndDate__c = WeekStartDate.addDays(edays2);
                                    sdays1 = sdays1 + 7;
                                    edays2 = edays2 + 7;
                                }
                                else{
                                    invoiceLineItem.StartDate__c = WeekStartDate;
                                    invoiceLineItem.EndDate__c = WeekEndDate;
                                  
                                }
                                oliIli.add(new opportunityLineItemInvoiceLineItemWrapper(invoiceLineItem, olis));
                              
                            }

 

              }

 

 

 

Thanks in Advance...  :)

  • November 26, 2013
  • Like
  • 0

How can i show the show or hide for the individual sections.. not for all.

 

page:

 

<apex:page controller="questionsClass">
<apex:form >
<apex:actionfunction name="showAnswer" action="{!showAnswer}" rerender="out1"/>
<apex:actionfunction name="hideAnswer" action="{!hideAnswer}" rerender="out1"/>

<!--
<apex:commandLink value="Expand" action="{!showAnswer}" reRender="out1"/> | &nbsp;
<apex:commandLink value="Collapse" action="{!hideAnswer}" rerender="out1"/>
-->

<apex:outputpanel id="out1">
<table>
<tr height="20px;">
</tr>
<apex:repeat value="{!lstQC}" var="QC">
<tr>
<td>
<apex:image value="{!$Resource.plus}" onclick="showAnswer();" rendered="{!plusimg}"/>
<apex:image value="{!$Resource.minus}" onclick="hideAnswer();" rendered="{!minusimg}"/>
</td>
<td>
<apex:outputtext value="{!QC.q}" style="font-size:15px;font-weight:bold;color:red;"/>
</td>
</tr>
<tr >
<td>
</td>
<td >
<apex:outputtext value="{!QC.a}" style="margin-left:50px;color:green;" rendered="{!expandedval}"/>
</td>
</tr>
</apex:repeat>
</table>
</apex:outputpanel>
</apex:form>
</apex:page>

 

 

class:

 

public with sharing class questionsClass {

public void hideAnswer() {
expandedval = false;
minusimg = false;
plusimg = true;

}

public void showAnswer() {
expandedval = true;
minusimg = true;
plusimg = false;
}


public boolean minusimg { get; set; }
public boolean plusimg { get; set; }
public boolean expandedval { get; set; }
public List<Q_A__c> lstqa{get;set;}
public List<QuesClass> lstQC{get;set;}
public questionsClass(){
expandedval = false;
plusimg = true;
minusimg = false;
lstqa = new List<Q_A__c>();
lstqa = [select id,name,answer__c from Q_A__c];
lstQC = new List<QuesClass>();
for(Integer i=0;i<lstqa.size();i++){
QuesClass objQC = new QuesClass();
objQC.q = lstqa[i].Name;
objQC.a = lstqa[i].answer__c;
lstQC.add(objQC);
}
}

public class QuesClass{
public String q{get;set;}
public String a{get;set;}
}
}

 

 

Once i clicked on + for any record it was expanding all sections... But not the specific one.

 

I need to show only the specific section that i clicked.

 

Can you help me.

Hi,

 

I dont know whether it is possible or not.

 

I have two components and a page.

 

I am using components in a page and rendering the second component.

 

But the second component is not rendering properly.

 

Any Idea!

 

VF Page Code:

 
<apex:page >
  <apex:form >
          <apex:outputpanel id="op1">
               <c:VCContacts ></c:VCContacts>
          </apex:outputpanel>
          
          
          <apex:outputpanel id="op2">
              <apex:actionstatus id="mystatus" startText="loading....">
                  <apex:facet name="stop" >
                      <c:VCConSelect ></c:VCConSelect>
                  </apex:facet>
              </apex:actionstatus>
          </apex:outputpanel>
 
   </apex:form>
</apex:page>
 
 
 
 
********************************
Component1 (VCContacts):
 
 
 
Code:
 
<apex:component controller="ContactsDisplayClass">
  <apex:pageBlock >
      <apex:pageBlockTable value="{!lstWC}" var="wc">
        <apex:column headerValue="Action">
            <apex:inputcheckbox value="{!wc.ischecked}"/>
        </apex:column>
        <apex:column headerValue="Name" value="{!wc.objC.name}"/>
      </apex:pageBlockTable>
      <apex:commandButton value="ShowSelected" action="{!doShow}" reRender="op2" status="mystatus"/>
  </apex:pageBlock>
</apex:component>
 
 
 
*******************************
Component2 (VCConSelect)
 
Code:
 
<apex:component controller="ContactsDisplayClass">
            <apex:pageBlock >
                  <apex:pageBlockTable value="{!selContacts}" var="sc">
                          <apex:column headerValue="Name" value="{!sc.Name}"/>
                  </apex:pageBlockTable>
              </apex:pageBlock>
</apex:component>
 
 
*******************
Common Controller for both Components:
 
 
Controller code:
 
public with sharing class ContactsDisplayClass {
    public List<String> conIds = new List<String>();
    public void doShow() {
        for(wrapContactcs objWC : lstWC){
            if(objWC.ischecked == true){
                conIds.add(objWC.objC.Id);
            }
        }
        selContacts = new List<contact>();
        selContacts = [select id,name from Contact where ID IN : conIds];
        system.debug('--selContacts are -->'+selContacts);
    }
 
    public List<Contact> selContacts{get;set;}
    public List<Contact> lstC{get;set;}
    public List<wrapContactcs> lstWC{get;set;}
 
    public ContactsDisplayClass(){
        lstC = new List<Contact>();
        lstC = [select id,name,AccountId from Contact where AccountId =: apexPages.currentpage().getParameters().get('id')];
        lstWC = new List<wrapContactcs>();
        
        for(Contact objC : lstC){
            wrapContactcs objWC = new wrapContactcs();
            objWC.objC = objC;
            lstWC.add(objWC);
        }
    }
    
    public class wrapContactcs{
        public boolean ischecked{get;set;}
        public Contact objC{get;set;}
    }
}
 
 

 

 

<apex:page id="p1">
    <apex:includeScript value="{!$Resource.jQueryFile}"/>
 
    <input type="button" value="welcome" id="txt1"/> 
    <apex:outputText value="hello, good morning" id="txt2" rendered="false"></apex:outputText>
    
     <script>
     $(document).ready(function() {
        test();
     });
 
     $('#txt1').click(function() {
         // alert(document.getElementById('txt2').value);
         alert('hello');
      });
       
           
     </script>
</apex:page>
 
 
 
Q : Why this statement is showing : Undefined ( // alert(document.getElementById('txt2').value);)

Hi

 

I am using <apex:repeat> including a wrapper list to bind in the table tr and tds.

 

when the page is rendering as pdf then the repeater is not showing any list.

 

Any Idea!

Hi I have created a component with a specific format.

 

And i generated a pdf that contains 10 pages.

 

How can i attach my component as a footer to all the pages in the PDF?

 

 

I tried different samples from google, and could not find this.

When i click on "Yes" radio i need to show the section that is having required field. When im clicking on "No" i need to hide the section.  But it is working fine when i click on "Yes" and when i click on "No" the required field asking a value.

 
Can you pleae correct the code :
 
 
Page:
 
<apex:page controller="SelectRadioclass" id="p1">
    <script>
        function InvoiceAddr(){
            alert('hi');
            document.getElementById('p1:f1:btnsearchforlonglat').click();  
        }
    </script>
 
      <apex:form id="f1">
          <apex:SelectRadio value="{!AddressOption}" onclick="InvoiceAddr();" >
                <apex:selectOptions value="{!yesno}"/>  
          </apex:SelectRadio>
 
      
      <apex:actionFunction name="test" action="{!InvoiceAddress}" /> 
     <apex:commandButton value="test" id="btnsearchforlonglat"  onclick="test();" immediate="true"  style="display:none;" />
           
     
      <apex:pageblock >
          <apex:pageblockSection title="Billing Address" rendered="{!BillingBool}" >
                                    <apex:inputField value="{!Acct.ShippingCity}" required="true"/>  
                    </apex:pageblockSection> 
       </apex:pageblock>
            
     </apex:form>
</apex:page>
 
 
class:
 
 
public with sharing class SelectRadioclass {
 
    public pagereference InvoiceAddress(){
               system.debug('---entered--');
                if(AddressOption == 'true'){
                    system.debug('---true--');
                     BillingBool = true;
                }else{ 
                          system.debug('---false--');
                          BillingBool = false;
                }
                return null;
       }              
               
 
               
 
 
    public boolean BillingBool { get; set; }
    public Account Acct{get;set;}
    
    public SelectRadioclass(){
        acct = new Account();
    }
     public List<SelectOption> getYesNo() {
                List<SelectOption> options = new List<SelectOption>();
                 options.add(new SelectOption('true', 'Yes'));
                 options.add(new SelectOption('false', 'No'));
                 
                return options;
                  }
 
 
    public String AddressOption { get; set; }
}

Hi,

 

how to retrieve parent object field from attachment query..

 

Thanks,

Lakshmi

All I am currently displaying a VF page in landscape. I understand the attributes and the display for this is correct. The issue I am having is that when I render the PDF, it will not display in landscape, even when usine the  size: landscape;           attribute. Is anyone aware of a different way of rendering this?

 

Thank you for any assistance.

Hi guys

 

i have three lists of different objects in my controller and i have to retrieve values from that lists and display it in VF page which is rendered as pdf.

 

but when i try to use dataTable or PageBlockSection it doesnot show anyvalue and when i use <apex:repeat> then it displays value but for two times i know because repeat works like for loop for display records but how i can display the field values can anyone please tell me exact sytnax? i am using the following code now but its not showing

<apex:dataTable value="{!accounts}" var="a">

<tr>
<td>ROC No. <span class="wrapper" style="padding: -1px 0 0 90px; border:solid #000 1px;"><input type="text" style="height:20px;" size="10" />{!a.ROC_No__c}</span>JKKP Reg. No.<span class="wrapper" style="padding: 4px 0 0 72px; border:solid #000 1px;"><input type="text" style="height:15px;" size="20"/></span></td>
<td style="background-color:#cecece;"></td>
<td rowspan="4"></td>
</tr>

</apex:dataTable>

 

Please Help!

Hi all, I don't know how to do this. Please suggest any idea, I have one Custom Object Accesioning , I  have created one visual force page to save the records into it. This Accesioning has Multiple relation with another object (all are child of this or look up relation). Now I want on the click of edit button of list view (Standard salesforce page) of accesioning . the same VF page should be  open with all the fileds already filled and I can update  the Accesioning object. Please help me in this any blog, any article or any idea.

 

One more thing. Can any one suggest me like If  the url of my page is https://c.cs15.visual.force.com/apex/Accession if I pass the id of particular accesioning as query string than it should show all the data of Accesioning  like  if I type this URL https://cs15.salesforce.com/a02e0000001eYCL

 

than detail page of particular accesioning is opening where ''a02e0000001eYCL" id id of a prticular Accesioning record.

 

Please suggest anything on any of the requirment

 

Regards

Raman

Hello,

 

I want to create a duplicate opportunity, for example, if opportunity stage is equal to “won” , I want it to be able to create an exact replica of the old opportunity.  I know I’ll have to make a workflow and use apex code.

 

How can I write the formula for this?

Hi,

I am trying to export the data to excel sheet from apex class.

i know that we can do the export from vocabularies page.but i want that export to be done from apex class.

how can i achieve this?Please help me out.

  • July 17, 2013
  • Like
  • 0

HI

 

I am working with multi colored bar charts.

 

I have 5 fields, and get a list throuth wrapper and displayed in <apex:chart/> and working fine.

 

Questions is,

 

<apex:barSeries title="R1,R2,R3,R4,R5" orientation="horizontal" axis="bottom"  xField="data,data1,data2,data3,data4" yField="name" colorSet="blue,Magenta,Yellow,LightSeaGreen,cyan" stacked="true">
      <apex:chartTips height="20" width="120"/>
 </apex:barSeries> 
 
 
In above code, How can i add a  dynamic color for the values based on filter... 
 
For ex, 
IF(R1>0 && R1 <=10) : Color should be red
IF(R!>10 && R1<=20) : Color should be green  .. etc
 
like this based on a specific criteria i want to add a color value in colorSet.
 
In General we can bind the IF() in "Style" tags and then we can apply the conditions accordingly.
But here barseries is not having a "Style" tag to do this.
 
Any Idea!
 
 
Thank you

HI

 

Need a CSS that helps to make a sample HTML table with pageblock table in look and feel.

 

 

Thank you

Hi

 

I used below css to get the landscape page and it is renderedAs PDF.

 

<head>
<style>
@page{
size:landscape;
}
</style>
</head>

 

The same code worked fine long ago. Now its not working.

 

Can you let me know, what reasons may cause this?

 

 

can we give numbering for retrieved records in vf page???????

Can any one Explain.......Thanx in Advance

 
  • June 09, 2013
  • Like
  • 0