You need to sign in to do that
Don't have an account?

Was there any change in the VisualForce core code- My pages are not working?
Hi,
I developed a wizard with VisualForce pages and everything was working perfectly fine till yesterday and today I find that most of my logic is falling and this is one thing that I noticed -
I developed a wizard with VisualForce pages and everything was working perfectly fine till yesterday and today I find that most of my logic is falling and this is one thing that I noticed -
Since I am using the rendered attribute to hide and display sections depending on different condition, I need the Boolean flag in various methods of my controller to either true or false. In methods where I have set the flags and suppose that method does not return a Boolean, the logic is not working.
Say for example in Wizard Step 2
public Contract getContract()
{
Id contractId = System.currentPageReference().getParameters().get('Id');
if(contract == null)
{
if(contractId == null)
{
contract = new Contract();
}
else if(contractId != null)
{
contract = [select id, AccountId, StartDate, END_DT__c, ContractTerm, ADV_NOTICE__c,CRT_COM__c from Contract
where id = :contractId];
}
}
return contract;
{
Id contractId = System.currentPageReference().getParameters().get('Id');
if(contract == null)
{
if(contractId == null)
{
contract = new Contract();
}
else if(contractId != null)
{
contract = [select id, AccountId, StartDate, END_DT__c, ContractTerm, ADV_NOTICE__c,CRT_COM__c from Contract
where id = :contractId];
}
}
return contract;
//setButtonFlags();
}
In the above method getContract() I was calling the below method setButtonFlags() to set the various flags. As getContract() was the first method being called from the Controller by the page I was doing the initialization here but since getContract() method does not return a Boolean the values were not getting set.
}
In the above method getContract() I was calling the below method setButtonFlags() to set the various flags. As getContract() was the first method being called from the Controller by the page I was doing the initialization here but since getContract() method does not return a Boolean the values were not getting set.
/* Set the contractSummary and continue Button flags */
public void setButtonFlags()
{
String contractSum = System.currentPageReference().getParameters().get('contractSum');
if(contractSum != null && contractSum.equals('true'))
{
setContinueButton(false);
setContractSummary(true);
}
else
{
setContinueButton(true);
setContractSummary(false);
}
}
public void setButtonFlags()
{
String contractSum = System.currentPageReference().getParameters().get('contractSum');
if(contractSum != null && contractSum.equals('true'))
{
setContinueButton(false);
setContractSummary(true);
}
else
{
setContinueButton(true);
setContractSummary(false);
}
}
Then I called this method from the getContinueButton() and the code started working as this method returns Boolean.
/* This is the getter method for continueButton flag */
public Boolean getContinueButton()
{
setButtonFlags();
return this.continueButton;
}
public Boolean getContinueButton()
{
setButtonFlags();
return this.continueButton;
}
This was just a simple example, I have noticed the same behaviour in all the other pages. I was wondering what went wrong with all the pages that were working perfectly fine till yesterday. I don't know whether this is bug which came out while solving something else or a newly introduced restriction.
Can anyone please let me know what is the issue?
Thanks
Jina
Can anyone please let me know what is the issue?
Thanks
Jina
You should never rely on the order that getters/setters are invoked ("as getContract() was the first method being called from the Controller by the page") - there is not guaranteed order (never was) and writing code that relies on side effects inside of getters and setters is not a good idea.
Can you also post your page's markup - its very hard to follow statements like "In methods where I have set the flags and suppose that method does not return a Boolean, the logic is not working." w/out seeing how you are binding your components to your controller.
Also, I suspect that your pages/controller would be simplified greatly by using the standard controller in combination with a custom controller extension...
Even in the other pages where I set the Boolean flags in the getters of the method which does not return a Boolean fails. As these pages are called from different location and depending on different conditions I need to change the display of the page, so I am setting the flags on the getter methods instead of doing it on some action method.
Everything was working fine till yesterday and today it is failing. The code which I have pasted is one of my simple pages, there are much complex ones where I need to change a lot of display features. How to go about without putting the logic of setting other flags in getters?
How to use standard controller in combination with a custom controller extension...?
Thanks,
Jina