You need to sign in to do that
Don't have an account?
krishnag
how can i make a picklist value default
hi,
i have a visualforce page with two picklist values month and year. How can i make the values in the picklist default to current month and current year when the page loads,
In the constructor for your Controller, or ControllerExtension, set the values for the picklist fields.
This way they will be instantiated and set before the page renders and the getters are called to display them.
Best, Steve.
hi,
You can call action on the page load.call 'Action' in <apex:page action={!Prorprty}> and that function you can invoke through controller and set the value of picklist value in that method with system.now().
i tried both the ways its getting error when we give system.now since its a datetime the format changes right
i there anyway we can write a setmethod for that and give the current month on the field
like
public String setmonth()
{
this.month = THIS_MONTH;
return month;
}
Do you mean something like:
String m = datetime.now().format('mmmm');
String y = datetime.new().format('yyyy');
Best, Steve