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
Ranu JainRanu Jain 

dont want to call getter setter

Hi,

 

I have two button on VF page .

I want that when i click on button1 ,it should call getter setter but when i click on button2 i should not call to getter setters .

what should i do for it?

Shreya...Shreya...

HI,

 

You can't restrict the call of setter and getter but 

If you want such kind of functionality then write two constructor first will assignee the value and second will mark it as null and on the send button click call the 2nd constructor. 

 

 

Regards,

Shreyaa

Jerun JoseJerun Jose
As Shreya mentioned, you cant really control the getters and setter calls. The getter will be called whenever the system wants to read the data for a VF property and similarly the setter will be called whenever the system wants to write the data into that property.

However, when working with commandlinks and commandbuttons, if you set the attribute immediate=true, then the system will not call the setters for the form elements; so the view state data will not be captured in the apex variables.
Ranu JainRanu Jain
 Hi Shreya,
can we create two constructor for a controller .if yes than how they will be callled when page load.

Jerun JoseJerun Jose
Constructors are not very different from normal methods. You can overload the constructors by having different argument types. Depending on which argument is passed, that particular constructor will be called. You will get a compile time error if you try to define two methods with the same name, return type and argument type.
Ranu JainRanu Jain

Hi Jerun Jose,

 

Hi Jerun Jose,

 

Thanks for rply.

Acyaully i am asking  about construtor in controller. As par my knowledge we pass standardcontroller or standard set controller as arguement to construtor and its callled when page is load . we dont make any object for the controller manually

like

classname c = new classname();

 

so my query what will the different arguement of the construtor and how would i call this when page is loaded.

 

Thanks

Ranu

Jerun JoseJerun Jose
If your page uses a simple custom controller, then the no argument constructor is called
public myClass()

If your page uses a standard controller and if your are using an extension, then the standardController constructor will be called


If your page uses a standard controller and if your are using an extension and your page is a list pag (defined by the recordSerVar attirubute on the page), then the standardSetController constructor will be called