You need to sign in to do that
Don't have an account?
Larry D. Dortch
Is it possible to predefine a Date/Time field with NOW() using Visualforce markup?
Hello Group,
I've been attemtping to prepoulate a Date/Time field with the now() function in a Visualforce page but not having any luck.
I've tried using apex inputField, inputText and just apexInput - all returning their various errors and issues.
Is this not possible to do this with Visualforce markup and a Standard controller or does it require a custom apex controller or using javascript?
I've been attemtping to prepoulate a Date/Time field with the now() function in a Visualforce page but not having any luck.
I've tried using apex inputField, inputText and just apexInput - all returning their various errors and issues.
Is this not possible to do this with Visualforce markup and a Standard controller or does it require a custom apex controller or using javascript?
I'm just trying to set a Date/Time field with the default value now().
For example code, so far I've used something like this but doesn't work
<apex:inputField value="{!ClientVisit__c.Check_In_Time__c = NOW()}" />
ClientVisit__c.Check_In_Time__c = System.today();
Just to be clear, woluld I write the Constructor in an Extension controller?
try this,
Thanks,
If it helps you, please mark is as best answer, so it will be helpful for other developers.
Thank you for your suggestion but I'm not clear on how I would Save the param into my Date/Time field = Check_In_Time__c ?
You need to use controller, if you're using Standard Controller then use Extension else can use customer controller,
Check_In_Time__c = System.now(); // returns current GMT Datetime Value
Thanks.
It looks as if the answer to my original question is NO. Visualforce markup alone can't predefine a Date/Time field with the NOW() function.
Thank you all for your input!
Yes, you're right.
I have a suggestion,
Use Default Value in DateField, as ""Now()" and try out in VF Page.
Thanks,