I'm trying to add functionality to a JQuery mobile app someone else wrote and encountering problems with either the action method or the page reference class when trying to construct another page to appear in the App. I know it has to be something simple that I'm overlooking, but can't seem to quite nail it.

Here's the relevant portions of the code (far to much to post all of it).

VF Page:

<apex:page standardController="Account" extensions="SiteVisit"
    showHeader="false" sidebar="false" standardStylesheets="true">

        <apex:actionFunction action="{!goToLogACall}"

        <!-- Start of first page: #one -->
        <div data-role="page" id="one">

                    <--- working code skipped --->

                        <!--- ### Problem Section --->
                        <!-- Open Log A Call -->
                        <apex:outputPanel id="Open_LogACall" rendered="{!IF(ISBLANK(ClientId), false, true)}">
                            <a href="#" data-role="button" onclick="$.mobile.showPageLoadingMsg(); goToLogACall()" reRender="Open_Log_A_Call" >Log A Call</a>
                        <!--- ### End Problem Section ### --->

                    <--- more working code skipped --->

            <!-- /page one -->


Custom Controller Method:

public PageReference goToLogACall()

    System.debug('---> goToLogACall: ' + customerId + ' ' + clientId  );

    showLogACall = true;

    ShowBackButton = true;        

    //PageReference ReturnPageURL = getRetURL();

    PageReference pr = page.Log_A_Call;

    if ( clientMap != null && clientMap.keySet().size() > 0 )
        currentClient = clientMap.get(clientId );

    if(currentClient != null) currentClientName = currentClient.Name;

    cstmrParentId = customer.Parent_Customer__c;

    cstmrPrntName = getcstmrParentName(cstmrParentId); 


    System.debug('---> returning: ' + pr);

    return pr;  

At the moment, I'm getting this error message:

The value of the "id" parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit.

Prior to this, I had tried setting the problem section as a CommandButton and was receiving "ERROR: Formula Expression is required on the action attributes" which can mean a huge number of things including that the reRender attribute hasn't been set properly. I know I'm not doing something correctly.

The code I was using for that is below:

    <apex:commandButton action="{!goToLogACall}" value="Log A Call"
                    onclick="$.mobile.showPageLoadingMsg();" reRender="OpenLog_A_Call" >                        

What I want is for the page reference pr to render in <apex:outputPanel id="Open_LogACall">. How do I replace the button with the page reference being returned? Do I just need to set the redirect to true instead of false? What am I missing here?

  • Debug customerId to see what it has ? Jan 20 '16 at 19:52
  • Also is customerId an Account ID ?If its person Account may be its complaining that ID is invalid because your standard controller is Account ? Jan 20 '16 at 19:53
  • CustomerId is an Account. It has a value. ClientId is an account. It also has a value. Neither are person Accounts. They're just different record types. Have looked at this in Dev Mode and see appropriate values in the controller.
    – crmprogdev
    Jan 20 '16 at 20:02
  • If customerId is actually an Account, you must use customerId.Id - you cannot put Account objects into the Id Parameter of a VF-Page.
    – 0ff
    Jan 22 '16 at 20:53
  • It's expecting an Id for an Account. CustomerId is the Id for the "customer" type Account on the page. There are several different Accounts referenced on the same page. The 2nd is "currentClient" and the last is "cstmrParent" which is an "ultimate" parent, not a direct parent. I don't think all of the params I've used are needed for this page which is what my debugging is showing at present, particularly Id and customer.
    – crmprogdev
    Jan 22 '16 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.