function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mritzmritz 

Formula Expression is required on the action attributes

test_pg1

<apex:page controller="myController">
   <apex:form >
        <apex:inputText value="{!myStr}"/>
        <apex:commandButton value="Click Here" action="!test_pg2"/>
   </apex:form>
</apex:page>



test_pg2

<apex:page controller="myController">
    <apex:outputText value="{!myStr}"/>
</apex:page>

Controller

public class myController{
    public string myStr{get;set;}
    public myController(){
        myStr=null;
    }
}

Why am i getting above mentioned error when i click on BUTTON and go to next page.

Also, The url  also remain same ---> /apex/test_pg1
I think it should change to /paex/text_pg2
 
sandeep sankhlasandeep sankhla
Hi mritzi,

It should be formula expression
replace the command button with this..

<apex:commandButton value="Click Here" action="{!test_pg2}"/>

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

Thanks,
Sandeep
Salesforce Certified Developer 
sandeep sankhlasandeep sankhla
Hi mritzi,

You can not redirect the page from button directly by providing in action..

You should create one method inside your controller and then that method you shoudl call from action of this command button ..

inside that method you should use page reference tpo redirect it to another page...

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

Thanks,
Sandeep
Salesforce Certified Developer 
mritzmritz
When i use PageReference, the url remains same
/Apex/text_pg1

how do i change it to /Apex/test_pg2
when i redirect it??
sandeep sankhlasandeep sankhla
Hi mritzi,

Can you share your code so i can help you out ?
mritzmritz
see the question again

changes that i have made

test_pg1
<apex:commandButton value="Click Here" action="{!redr}"/>

myController

public PageReference redr(){  
       PageReference pageRef= new PageReference('/Apex/test_pg2');
       pageRef.setRedirect(false);        
       return pageRef;      
    }

rest remains the same
sandeep sankhlasandeep sankhla
Hi mritzi,

Can you paste your entire class code here ?
mritzmritz
public class myController{
    public string myStr{get;set;}
    public myController(){
        myStr=null;
    }
    public PageReference redr(){  
       PageReference pageRef= new PageReference('/Apex/test_pg2');
       pageRef.setRedirect(false);        
       return pageRef;      
    }
}
sandeep sankhlasandeep sankhla
Hi Mritzi,

Please check below link..

The issue can happen beause may b you are working in Development mode. So Salesforce treating the page as if it had frames. So the page never updated the URL. The moment you turned development mode off it will works perfectly.
mritzmritz
I turned it off
But the problem persists :(
sandeep sankhlasandeep sankhla
Hi Mritzi,

Check the below link for the same issue which you are talking about

https://developer.salesforce.com/forums/ForumsMain?id=906F000000096rNIAQ

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

Thanks,
Sandeep
Salesforce Certified Developer