• Patrick Dixon
  • NEWBIE
  • 74 Points
  • Member since 2011

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 23
    Questions
  • 73
    Replies

Probably its just me, because I do not see anybody complaining about this. I have a simple VF page with pageblock referencing to a wrapper object. I need to display text from that wrapper object in headerValue for a column, but cannot do that, After trying for almost half a day, I have given up. 

 

Please look at column 2, dynamic referencing cannot be simple that this. It is just calling a string field, objType from the wrapper class. If one argues, that it has to be sObject field, please look at column 3. I am typecasting it with hardcoded 'ListPrice' field, but it still won't work. 

 

What is most frustrating, inputText values within those 2 columns which is replica of 'headerValue' works just fine, I can see ObjectType and field Lable in 2nd and 3rd column respt. 

 

Please help me , am I missing something here? are 'headerValues' exception to dynamic binding. I am sure someone might have come across this in the past. 

 

VF page:

<apex:pageBlock >
 <apex:pageBlockTable id="tbl1" value="{!wObjs}" var="wObj">                  
  <apex:column headerValue="Select">   
    <apex:inputCheckbox value="{!wObj.selected}" required="true" />
  </apex:column>               
  <apex:column headerValue="{!wObj.objType}">   
    <apex:inputText value="{!wObj.objType}" required="true" /> 
  </apex:column>              
  <apex:column headerValue="{!$ObjectType[wObj.objType].Fields.ListPrice.Label}">   
    <apex:inputText value="{!$ObjectType[wObj.objType].Fields['ListPrice'].Label}" required="true" /> 
  </apex:column>                             
 </apex:pageBlockTable>
</apex:pageBlock>

 Apex class (wrapper object):

public class wObj{
 public sObject sObj {get; set;}
 public string objType {get; set;}
 public Boolean selected {get; set;}
		        
 public wObj(sObject childObjRecord, boolean selected){
   this.sObj = childObjRecord; 
   this.objType = childObjRecord.getSObjectType().getDescribe().getName(); 
   this.selected = selected;
 }
}

 

If I see something like the following code:

 

public class wrapper {

    private String string1;

    private Integer int2;

 

   public wrapper {

        this.String1 = 'abc';

        this int2 = 123';

    }

 

   public String getString1() {

        return this.String1;

    }

 

   public Integer getInt2() {

        return this.Int2;

    }

}

 

What do the 'this.'es signify and why would I need them?  Wouldn't the code work the same without them?

 

Thanks in advance.

 

 

 

 

I can't figure out how to save updated records back with a StandardSetController and an extension to paginate the (filtered) set of data.  I'm obviously missing the mechanism to get the filtered data set back to the standard set controller 'save' function, but I can't figure out how to add it.

 

VF page is:

 

<apex:page standardController="Orphan__c" extensions="OrphanBulkReportsWithPagination" recordSetVar="orphans">
    <apex:form >
        <apex:sectionHeader title="Bulk {!ReportType} Reports"/>
        <apex:pageBlock mode="edit">
            <apex:pageMessages />

            <apex:pageBlockSection title="Print {!ReportType}" collapsible="false">
                <apex:inputField value="{!Orphan__c.Biodata_Report_Sent__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Selected Orphans"  columns="1">
                <apex:pageblocktable value="{!PaginatedOrphans}" var="orphan" id="list">
                    <apex:column value="{!orphan.Name}"/>
                    <apex:column headerValue="Orphan Name">
                        <apex:outputText value="{!orphan.First_Name__c
                            & ' '
                            & orphan.Last_Name__c}"/>
                    </apex:column>
                    <apex:column value="{!orphan.Country__c}"/>
                    <apex:column value="{!orphan.IRP_Country__c}"/>
                    <apex:column headerValue="Biodata">
                        <apex:inputField value="{!orphan.Biodata_Report_Sent__c}"/>
                    </apex:column>
                </apex:pageblocktable>
            </apex:pageBlockSection>
            
            <apex:panelGrid columns="2">
                <apex:commandLink action="{!previous}">Previous</apex:commandlink>
                <apex:commandLink action="{!next}">Next</apex:commandlink>
            </apex:panelGrid>
            
            <apex:pageBlockButtons location="bottom">

                <apex:commandButton value="Save" action="{!saveOrphans}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

And controller extension is:-

 

public with sharing class OrphanBulkReportsWithPagination {

    Apexpages.StandardSetController controller;

    public OrphanBulkReportsWithPagination(ApexPages.StandardSetController c) {
        ReportType = ApexPages.currentPage().getParameters().get('rpt');
        Country = ApexPages.currentPage().getParameters().get('loc');
        controller = c;
    }    
    
    public ApexPages.StandardSetController orphanRecords {
        get {
            if(orphanRecords == null) {
                return new ApexPages.StandardSetController(
                         Database.getQueryLocator(
                [SELECT Id, name, First_Name__c, Last_Name__c, Country__c, IRP_Country__c, Biodata_Report_Sent__c FROM Orphan__c
                WHERE Biodata_Report_Sent__c = false
                And (Status__c = 'Available' OR Status__c = 'Sponsored')
                AND Id NOT IN (SELECT Orphan__c FROM Annual_Progress_Report__c where Sent_to_Donor__c = true)
                ]));
            }
            return orphanRecords;
        }
        private set;
    }

    public List<Orphan__c> getPaginatedOrphans() {
        return (List<Orphan__c>) orphanRecords.getRecords();
    }

}

 

Many thanks!

The standard list controller seems to be filtered using the last selected filter for the object, even if it's not applied explicitly in the VF page using the SLC.

 

Is there a way to force it to use a specified filterId when the VF page is called - without having the user select it in the page, or having the last used filter (which could be anything) affect the record set?

Hi,

 

 I created a custom List Button on Accounts ,which i placed it on Accounts View. when i Click that  i call a VF page

 

PAGE:

---------

 

<apex:page standardController="Account" contentType="text/csv#Contact.csv" cache="true" recordSetVar="Accounts"  extensions="Accounts_export">
Customer Name,
"Phone",
"Email Id",
"Billing Street",
"City",
"Billing State/Province",
"Zip/Postal Code"
<apex:repeat value="{!Accounts}" var="a">  
{!a.Name},
"{!a.Phone}",
"{!a.Business_Email__c}",
"{!a.BillingStreet}",
"{!a.BillingState}",
"{!a.BillingCity}",
"{!a.BillingPostalCode}"   
    
</apex:repeat>
</apex:page>
                 

 

and MY controller :

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

 

public class Accounts_export {

 

    public Accounts_export(ApexPages.StandardSetController controller) {

controller.setPageSize(4000);

    }

 

}

 

 

 

I am Facing problem to export 4000 records to CSV or Excel where i can export 2000 records sucessfully

 

The Error when i give size as 4000 is 

 

"system.security.NoAccessException: Object type not accessible. Please check permissions and make sure the object is not in development mode: invalid batch size: 4000 

 

 

 

 

"

 

Any Ideas ! 

I have a wrapper class within an apex controller:


    public list<sidebarWrapper> getSidebars() {
        list<sidebarWrapper> sidebars = new list<sidebarWrapper>();
        
        
            for (Sidebar_Element__c sidebar :
                [Select id, Name, Order_On_Page__c, Page_Layout__c, Content_Item__c, Content_Type__c,
                Twitter_Feed__c, No_of_Tweets__c, Keyword__c, No_of_Items__c, Synopsis_Length__c,
                Content_Item__r.Heading__c, Content_Type__r.Title__c, Content_Type__r.View_All__c, Content_Type__r.View_All_Dest__c,
                Content_Type__r.List_Length__c, Content_Type__r.Synopsis_Length__c
                From Sidebar_Element__c where Page_Layout__c = :pgId order by Order_On_Page__c asc]) {
                                
                sidebars.add(new sidebarWrapper(sidebar));
            }
        return sidebars;
   }

    // Wrapper Class for sidebar  
    public class sidebarWrapper {
        public Sidebar_Element__c sel {get; set;}
        public Content_Item__c sci;
        public list<Content_Item__c> scl;

        // constructor method
        
        public sidebarWrapper (Sidebar_Element__c thisSel) {
            sel = thisSel;
        }
        
        public Content_Item__c getItem()
        {
            if (null==sci)
            {
                try {
                    sci =
                        [select Id, URL_Link__c, Image__c, Synopsis__c, Release_Date__c, Name, Heading__c,
                        Attachment__c, (Select Id From Attachments limit 1),
                        Content_Type__r.Image_Position__c, Content_Type__r.Image_Border__c, Content_Type__r.Show_Date__c,
                        Content_Type__r.Read_More__c, Content_Type__r.Read_More_Dest__c,
                        (select Name, Content_Item__c, Description_Text__c from Contents__r order by name)
                        From Content_Item__c
                        where Id in (Select Content_Item__c From Sidebar_Element__c where id = :sel.id)
                        order by Release_Date__c desc];
                }
                catch(QueryException e) {
                    return null;
                }
            }
            return sci;
        }
    
        public List<Content_Item__c> getList()
        {
            if (null==scl && sel.no_of_items__c >= 1)
            {
                try {
                    string sKey;
                    if (sel.keyword__c != null) sKey = '%' + sel.keyword__c + '%';
                    else sKey ='%';
                    scl =
                        [Select URL_Link__c, Image__c, Synopsis__c, Release_Date__c, Name, Heading__c, Content_Type__c,
                        Internal_Link_Prefix__c, Keywords__c,
                        Attachment__c, (Select Id From Attachments limit 1),
                        (Select Id From Contents__r limit 1),
                        Content_Type__r.Id, Content_Type__r.Title__c, Content_Type__r.Show_Date__c,
                        Content_Type__r.Image_Position__c, Content_Type__r.Image_Border__c,
                        Content_Type__r.Read_More__c, Content_Type__r.Read_More_Dest__c,
                        Content_Type__r.List_Style__c, Content_Type__r.Searchable__c,
                        (Select Page_Layout__c From Sidebar_Elements__r) From Content_Item__c
                        where Content_Type__c in (select Content_Type__c From Sidebar_Element__c where id = :sel.id)
                        and Keywords__c like :sKey
                        order by Release_Date__c desc limit :sel.no_of_items__c.IntValue()];
                }
                catch(QueryException e) {
                    return null;
                }
            }
              return scl;
        }
        
    }
    // End Wrapper

}


and I'm trying to write a test:

 

<!--- SET SOME TEST DATA UP -->


        string pgl = 'testPage';
        string fl = 'testflash';
        
        ApexPages.currentPage().getParameters().put('pgl', pgl);
        ApexPages.currentPage().getParameters().put('mov', fl);

        // Instantiate a new controller  
        PageRenderer pr = new PageRenderer();
        list<sidebarWrapper> s = new list<sidebarWrapper>();


        string nl1 = pr.getNav_Level_1();
        string nl2 = pr.getNav_Level_2();
        boolean bb = pr.getBack_Button();
        Page_Layout__c ap = pr.getActivePage();
        list<Page_Element__c> el = pr.getElements();
        s = pr.getSidebars();
        list<Sidebar_Element__c> sel = s.sel();
        list<Content_Item__c> ci = pr.getContentItems();
        list<Content_Item__c> sci = s.getItem();
        list<Content_Item__c> cl = pr.getContentList();
        list<Content_Item__c> scl = s.getList();
        Content__c c = pr.getPageContent();
        string flash = pr.getFlash();

        ApexPages.StandardController sc = new ApexPages.standardController(pe[0]);

        PageElementExtension pee = new PageElementExtension(sc);
        ci = pee.getContentItems();
        cl = pee.getContentList();

        ApexPages.StandardController sc2 = new ApexPages.standardController(se[0]);

        SidebarElementExtension see = new SidebarElementExtension(sc2);
        ci = see.getsContentItems();
        cl = see.getsContentList();

 

But I just get:


Save error: Invalid type: sidebarWrapper    TestPageRender.cls    /fusionai.com/src/classes    line 59    Force.com save problem

 

So why can't it see the Wrapper Class??

 

I have a VF page with a 2-level nested apex:repeat structure with separate SOQL queries for each loop.  The outer loop returns (amongst other things) a list of strings which I want to use as filter terms in the inner loop's SOQL.  The list is saved as a list variable in the controller (keywords[]), along with an index integer (iKey) for the inner loop.

 

However, although I can see from the logs that the list of filter terms is all build correctly, the debug loop seems to show that the inner loop's SOQL is only run once and hence it only seems to use the first of the filter terms to get results.

 

Here's what the debug log looks like:-

 

 

18:58:54.115|CODE_UNIT_STARTED|[EXTERNAL]|01pA0000002NfKZ|PageRenderer get(sContentList)
18:58:54.115|CODE_UNIT_STARTED|[EXTERNAL]|01pA0000002NfKZ|PageRenderer invoke(getsContentList)
18:58:54.115|METHOD_ENTRY|[155]|LIST.size()
18:58:54.115|METHOD_EXIT|[155]|LIST.size()
18:58:54.115|METHOD_ENTRY|[156]|System.debug(ANY)
18:58:54.115|USER_DEBUG|[156]|DEBUG|%all%
18:58:54.115|METHOD_EXIT|[156]|System.debug(ANY)
18:58:54.115|METHOD_ENTRY|[155]|LIST.size()
18:58:54.115|METHOD_EXIT|[155]|LIST.size()
18:58:54.115|METHOD_ENTRY|[156]|System.debug(ANY)
18:58:54.115|USER_DEBUG|[156]|DEBUG|%
18:58:54.115|METHOD_EXIT|[156]|System.debug(ANY)
18:58:54.115|METHOD_ENTRY|[155]|LIST.size()
18:58:54.116|METHOD_EXIT|[155]|LIST.size()
18:58:54.116|METHOD_ENTRY|[156]|System.debug(ANY)
18:58:54.116|USER_DEBUG|[156]|DEBUG|%
18:58:54.116|METHOD_EXIT|[156]|System.debug(ANY)
18:58:54.116|METHOD_ENTRY|[155]|LIST.size()
18:58:54.116|METHOD_EXIT|[155]|LIST.size()
18:58:54.116|METHOD_ENTRY|[156]|System.debug(ANY)
18:58:54.116|USER_DEBUG|[156]|DEBUG|%fractal%
18:58:54.116|METHOD_EXIT|[156]|System.debug(ANY)
18:58:54.116|METHOD_ENTRY|[155]|LIST.size()
18:58:54.116|METHOD_EXIT|[155]|LIST.size()
18:58:54.116|SOQL_EXECUTE_BEGIN|[159]|Aggregations:3|Select URL_Link__c, Image__c, Synopsis__c, Release_Date__c, Name, Heading__c, Content_Type__c,
Internal_Link_Prefix__c, Keywords__c,
Attachment__c, (Select Id From Attachments limit 1),
(Select Id From Contents__r limit 1),
Content_Type__r.Id, Content_Type__r.Title__c, Content_Type__r.Show_Date__c,
Content_Type__r.Image_Position__c, Content_Type__r.Image_Border__c,
Content_Type__r.Read_More__c, Content_Type__r.Read_More_Dest__c,
Content_Type__r.List_Length__c, Content_Type__r.Synopsis_Length__c,
Content_Type__r.List_Style__c, Content_Type__r.Searchable__c,
(Select Page_Layout__c From Sidebar_Elements__r) From Content_Item__c
where Content_Type__c in (select Content_Type__c From Sidebar_Element__c where Page_Layout__c = :pgId)
and Keywords__c like :keywordList[iKey++]
order by Release_Date__c desc
18:58:54.143|SOQL_EXECUTE_END|[159]|Rows:3
18:58:54.143|METHOD_ENTRY|[172]|System.debug(ANY)
18:58:54.143|USER_DEBUG|[172]|DEBUG|1
18:58:54.143|METHOD_EXIT|[172]|System.debug(ANY)
18:58:54.143|METHOD_ENTRY|[173]|System.debug(ANY)
18:58:54.143|USER_DEBUG|[173]|DEBUG|%
18:58:54.143|METHOD_EXIT|[173]|System.debug(ANY)
18:58:54.143|CODE_UNIT_FINISHED|PageRenderer invoke(getsContentList)
18:58:54.143|CODE_UNIT_FINISHED|PageRenderer get(sContentList)

The filter terms %all%, %, %, %fractal% are correct, but the SOQL query should execute 4 times ... and must do as I get 4 results on the VF page.

 

So what's going on?

 

I have the following VF page using custom objects and a custom controller to generate the page content:-

 

<apex:page showHeader="false" controller="PageRenderer" title="FusionExperience" >
<apex:stylesheet value="{!URLFOR($Resource.fusionexperience, 'css/reset.css')}" />
<apex:stylesheet value="{!URLFOR($Resource.fusionexperience, 'css/style.css')}" />
<apex:stylesheet value="{!URLFOR($Resource.fusionexperience, 'css/type.css')}" />

<!-- CONTENT -->
<div id="content">

    <!-- PAGE ELEMENTS (PASSED THROUGH PGL PAGE PARAM) -->
    <apex:outputPanel rendered="{!NOT(elements.size=0)}">
        <apex:repeat var="el" value="{!elements}" >

            <!-- (LIST OF) CONTENT TYPE -->

            <apex:variable var="clRender" value="{!NOT(ISNULL(el.Content_Type__c))}" />
            <apex:outputPanel rendered="{!clRender}" layout="block" styleClass="box">
                <div class="viewdiv {!el.Box_Size__c}">
                    <!-- BOX TITLE -->
                    <!-- uses content type title -->
                    <div class="latestnews headline">
                        <h3>{!el.content_type__r.Title__c}</h3>
                    </div>
                    
                    <!-- //BOX TITLE -->
                    
                    <!-- OUTLINED BOX -->
                    <div class="latestnews content">
                        <ul class="latestnews">
                            <apex:variable var="noItems" value="{!el.content_type__r.List_Length__c}" />
                            <apex:repeat var="cl" value="{!ContentList}" >
 
                                <!-- Only list content of THIS content type -->
                                <apex:variable var="clRender" value="{!AND(noItems>0, cl.Content_Type__c=el.Content_Type__c)}" />
                                <apex:outputPanel rendered="{!clRender}" >
                        
                                    <!-- IMAGE/URL -->
                        
                                    <apex:variable var="isPDF" value="{!IF(cl.Attachment__c='pdf', cl.Use_Attachment__c, false)}"/>
                                    <apex:variable var="isFlash" value="{!IF(cl.Attachment__c='flash', cl.Use_Attachment__c, false)}"/>
                                    <apex:variable var="readMore" value="{!IF(cl.content_type__r.Read_More__c,true,false)}" />

                                    <!-- establish pdf string -->
                                    <apex:variable var="pdfLink" value="{!IF(isPDF, IF(cl.Attachments.size=0, '', cl.Attachments[0].id), '')}"/>
                                    <apex:variable var="pdfLink" value="/servlet/servlet.FileDownload?file={!pdfLink}" />
                                
                                    <!-- establish flash string -->
                                    <apex:variable var="flashLink" value="{!IF(isFlash, IF(cl.Attachments.size=0, '', cl.Attachments[0].id), '')}"/>
                                    <apex:variable var="flashLink" value="fe?id={!cl.Content_Type__r.Read_More_Dest__c}&mov={!flashLink}" />
                        
                                    <!-- establish URL string for new page view -->
                                    <apex:variable var="itmLink" value="{!IF(cl.Contents__r.size=0, '', cl.Contents__r[0].id)}" />
                                    <apex:variable var="itmLink" value="fe?id={!cl.Content_Type__r.Read_More_Dest__c}&itm={!itmLink}" />
                                    <apex:variable var="itmLink" value="{!IF(cl.Contents__r.size=0, '', itmLink)}" />

                                     <apex:variable var="link" value="{!IF(readMore, IF(isPDF, pdfLink, IF(isFlash, flashLink, itmLink)), cl.URL_Link__c)}" />


                                     <!-- TEXT BLOCK -->
                                    <li class="latestnews">
                                        <a href="{!link}" class="latestnews">{!cl.Heading__c}<br /></a>
                                        <apex:variable var="sRender" value="{!NOT(cl.Content_Type__r.Synopsis_Length__c=0)}" />
                                        <apex:outputText rendered="{!sRender}" escape="false" styleClass="latestintro" value="{!LEFT(cl.Synopsis__c,cl.Content_Type__r.Synopsis_Length__c)}..." />
                                    </li>
                                    <apex:variable var="noItems" value="{!noItems-1}" />
                                </apex:outputPanel>
                            </apex:repeat>
                        </ul>
                    </div>
                </div>
             </apex:outputPanel>
 
              <!-- //CONTENT TYPE -->
                     
        </apex:repeat>
    </apex:outputPanel>

<!-- //CONTENT -->

</div>
</apex:page>

 

However, it's not formatting correctly in the browser, and when looking at the html code produced:

 

(see here) http://www.yatecourtbarn.adsl24.co.uk/images/test.html

 

It seems to be producing code that is missing the closing </div> tags, and hence screwing-up the css layout.

 

AFAICS, it has opening nested <div> tags for 'box', 'box-left viewdiv', and 'content latestnews', but only closes two of them before the next opening sequence.

 

Has anyone come across this before and/or can anyone offer a solution?

 

Thanks.

 

I have a VF page including:

 

        <apex:form >
            <apex:pageBlock mode="edit" id="searchText">

                <apex:pageMessages />
                <apex:pageBlockSection >
                    <apex:pageBlockSectionItem >
                        <apex:panelGroup >
                            <apex:inputText id="searchTerm" value="{!searchTerm}"/>
                            <apex:commandButton value="Search" action="{!search}" rerender="results" status="status"/>

                        </apex:panelGroup>
                    </apex:pageBlockSectionItem>
                </apex:pageBlockSection>

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

        <apex:actionStatus id="status">
            <apex:facet name="start">
                <apex:outputText styleClass="searchword inputbox" value="searching... for '{!searchTerm}'"/>
            </apex:facet>
            <apex:facet name="stop">
            
            <apex:outputPanel id="results">


          ............displays the search results here................


        </apex:outputPanel>

        </apex:facet>
    </apex:actionStatus>
<br/>
debug -- {!searchTerm}<br/>

 

and a controller

 

public with sharing class SearchController {

    public SearchController() {
        searchResultLists = new List<Content_Item__c>();
        searchTerm = 'search...';
    }

    public List<Content_Item__c> searchResultLists { get; set; }

    public String searchTerm { get; set; }

    public void search() {
        for(List<Content_Item__c> results : search.query('find :searchTerm in all fields returning Content_Item__c'))
            searchResultLists = [select id, name, synopsis__c,
                URL_Link__c, Image__c, Release_Date__c, Heading__c, Content_Type__c,
                content_type__r.name,
                Content_Type__r.Id, Content_Type__r.Title__c, Content_Type__r.Show_Date__c,
                Content_Type__r.Image_Position__c, Content_Type__r.Image_Border__c,
                Content_Type__r.Read_More__c, Content_Type__r.Read_More_Dest__c,
                Content_Type__r.List_Length__c, Content_Type__r.Synopsis_Length__c,
                Content_Type__r.List_Style__c,
                Use_Attachment__c, Attachment__c, (Select Id From Attachments limit 1),
                (select id from Contents__r limit 1) from Content_Item__c where id in :results];
    }


}

 

I also have the following in a header component that renders through the template for the page:

 

       <apex:form >
        <div class="clearfix search">
             <div class="search-box">
                 <apex:inputText id="searchTerm" alt="search..." styleClass="searchword inputbox" value="{!searchTerm}" maxlength="20"/>
                 <apex:commandButton action="{!search}" styleClass="button" rerender="searchText" status="status"
                     image="{!URLFOR($Resource.fusionexperience, 'images/searchButton.gif')}" />
           </div>
       </div>
    </apex:form>

 

Both the page and the component reference the (same) custom controller in their header.


Now I'm getting two problems:


The first is that although entering the search text in the header component and clicking the command button triggers the controller action, the input text never seems to be passed to the controller and so the search fails.


The second is that although entering the search text in the main page and clicking its command button, does pass the search text and return the correct results, the debug line at the bottom of the page and the searching message in the facet don't return the expected  {!searchTerm} string - it's always the intialised value 'search...'


So what am I doing wrong?

I'm building a site using force sites and I need a simple search facility to search my custom objects.  Unfortunately the field I need to search on is a text area and SOQL won't search text areas AFAIU.  So I figure I need to use SOSL, but the problem is that I can't figure out the syntax of what I need to do.

 

I understand the search bit:

 

String searchquery='FIND\'%'+searchText+'%\'IN ALL FIELDS RETURNING Content_Item__c (id,name), Content__c';
list<list<Content_Item__c>> searchList = search.query(searchquery);

 

but I don't understand what to do next or how to render the results in a VF page using a standard controller.

 

Can anybody point me at an example?  This must be a really common requirement for a web site, but I can seem to find any examples to get me started.

I created a VF page and I associated it with a Salesforce page that i created. I create a inputfield whereby users can input the ID of the person within the database. My question is how do i create a button with the function of search. for example and the user would input the ID of the person they are looking for then they would hit this custom button and the name, address and etc associated with the ID will show up. 

 

I got as far as 

 

<apex:commandbutton action=" " value = "Search>

 

I don't know what to input in the for the action. 

 

Please help. 

 

Thank you. 

Hello Gurus,

 

I have a VisualForce page that is calling a Custom StandardSetController with Pagination. I go to page #2 and update a record. After I hit save, I am directed back to first page although {!CurrentPage} displays Page #2. How can I stay on the current record/Page after I hit save?

Here is the relevant code:

 

Controller code:

public with sharing class SMADummy {
    
public ApexPages.StandardSetController setCon {
    get {
        if (setCon== null){
            system.debug('Calling locator');
        setCon=new ApexPages.StandardSetController(Database.getQueryLocator(
                            [Select s.Name, Activity_Start_Date__c,Activity_End_Date__c From Dummy__c s order by name limit 30]));
                 
                
               
            }
            return setCon;
        }
        set;
    }
   public List<Smart_Marketing_Activity__c> getActivities() {
     
         return (List<Smart_Marketing_Activity__c>) setCon.getRecords();
 }

 

VF Code:

<apex:page controller="SMADummy">

<apex:form>

<apex:pageBlock>

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

  <apex:commandLink action="{!setCon.previous}" immediate="true" >Previous</apex:commandlink>
    <apex:commandLink action="{!setCon.next}" immediate="true">Next</apex:commandlink>
     <apex:pageBlockTable value="{!Activities}" var="SMA" >

 

 <apex:column >
               <apex:facet name="header">Activity Start Date</apex:facet>
               <apex:inputField value="{!SMA.Activity_Start_Date__c}" />
            </apex:column>

....

....

 </apex:pageBlockTable>
      
     </apex:pageBlock>
  </apex:form>

</apex:page>

This ought to be simple, but I can't figure out how to do it - I want to pass an integer number from a VF page to a custom controller to use in a SOQL query.

 

Something like this-

 

     public News_Item__c[] getHeadlines() {
         String recordsCount = ApexPages.currentPage().getParameters().get('recordsCount');
         Integer irecordsCount = integer.valueof(recordsCount);
         return [select Name,
             id,
            Release_Date__c,
            Title__c,
            Synopsis__c,
            Item__c from News_Item__c order by Release_Date__c desc limit :irecordsCount];
     }

 

However, the recordsCount String/Integer needs to be set statically in the VF page so that I can call different numbers of records using the same controller method in different situations.

 

I don't seem to be able to use apex:param, because I'm not clicking any buttons or inputing anything - I just want to set the variable in the page markup.

 

Thanks in advance.

Hi all,

For some reason I am having a date picker appear on my VF pages.  By date picker, I mean two picklists side by side, one listing the months and one listing years from 2009-2015.  Below that is text: SunMonTueWedThuFriSat.  Then below that is a blankspot where I assume a calendar should be followed by a blue "Today" link.

 

Below is the source form the generated page:

 

</html><div class="datePicker" id="datePicker"><div class="dateBar"><img src="/s.gif" alt="Previous Month"  class="calLeft" onblur="this.className = 'calLeft';" onclick="DatePicker.datePicker.prevMonth();" onfocus="this.className = 'calLeftOn';" onmouseout="this.className = 'calLeft';" onmouseover="this.className = 'calLeftOn';" title="Previous Month"/><select  id="calMonthPicker" name="calMonthPicker" title="Month"><option value="0">January</option>
<option value="1">February</option>
<option value="2">March</option>
<option value="3">April</option>
<option value="4">May</option>

<option value="5">June</option>
<option value="6">July</option>
<option value="7">August</option>
<option value="8">September</option>
<option value="9">October</option>
<option value="10">November</option>
<option value="11">December</option>
</select><img src="/s.gif" alt="Next Month"  class="calRight" onblur="this.className = 'calRight';" onclick="DatePicker.datePicker.nextMonth();" onfocus="this.className = 'calRightOn';" onmouseout="this.className = 'calRight';" onmouseover="this.className = 'calRightOn';" title="Next Month"/><select  id="calYearPicker" name="calYearPicker" title="Year"><option value="2009">2009</option>
<option value="2010">2010</option>

<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
</select></div><div class="calBody"><table  class="calDays" border="0" cellpadding="0" cellspacing="0" id="datePickerCalendar"><tr><TH class="dayOfWeek" scope="col">Sun</TH><TH class="dayOfWeek" scope="col">Mon</TH><TH class="dayOfWeek" scope="col">Tue</TH><TH class="dayOfWeek" scope="col">Wed</TH><TH class="dayOfWeek" scope="col">Thu</TH><TH class="dayOfWeek" scope="col">Fri</TH><TH class="dayOfWeek" scope="col">Sat</TH></tr>

<tr class="calRow" id="calRow1"><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td></tr>
<tr class="calRow" id="calRow2"><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td></tr>
<tr class="calRow" id="calRow3"><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td></tr>
<tr class="calRow" id="calRow4"><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td></tr>
<tr class="calRow" id="calRow5"><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td></tr>
<tr class="calRow" id="calRow6"><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td><td onblur="hiOff(this);" onclick="DatePicker.datePicker.selectDate(this);" onfocus="hiOn(this);" onmouseout="hiOff(this);" onmouseover="hiOn(this);">&nbsp;</td></tr>
</table><div class="buttonBar"><a href="javascript&colon;%20void%280%29%3B" class="calToday" onclick="DatePicker.datePicker.selectDate('today');return false;">Today</a></div></div></div>

 

 

However on my VF page, the final lines look like this:

 

</body></apex:form>
    </html>
</apex:page>

 

 

Any ideas where that picker might be coming from?  Unfortunately I am unable to post the full source, so I created a new VF page with only:

 

<apex:page sidebar="false" showHeader="false" standardController="Opportunity"   >
    <html>
      <apex:form > 
      </apex:form>
    </html>
</apex:page>

 

The date picker items still appear!  A solid head-scratcher.