+ Start a Discussion
Ken_KoellnerKen_Koellner 

Input for Date, Time, and Datetime data

It looks to me that if you have a Date or Datetime field in an sObject and uses InputField, you get a nice Data or Datetime selector feature when the page renders.

 

What about if you just have a Date, Datetime, or Time values in Apex merge variables that are not sObjects and want to do input without directly connecting to an sObject field?

 

Is there no way to get access to the same date, and datetime selector on the page?

 

It would also be nice if there were a Time entry feature that works like Time does on the Event page layout.

 

There's nothing like that built into VF?

 

 

bob_buzzardbob_buzzard

Nothing as far as I'm aware.

 

We've handled this in one of two ways in the past:

 

(1) Instantiate a standard or custom object that contains fields of the type that you are interested in, and use these to back the input fields on the page.  This can get a bit sticky if you have objects restricted by profile etc.

 

(2) Added our own pickers - we've had to do this once or twice to capture birthdates etc as the standard salesforce picker doesn't go back far enough.

Ken_KoellnerKen_Koellner

So, I guess you can use a 'dummy' sCustom Object with open permissions.  Then move the fields from that to where you want them.

 

Unfortunately, there's no Time type in sObjects.

 

Event has a nice time picker.  Too bad you can't reuse that.

 

 

bob_buzzardbob_buzzard

Yes - in a couple of cases where we're doing lots of local processing and hardly any saving to the database, we have a "carrier" object that contains around 10 fields of each type.  Not exactly elegant and burns a custom object but the best we could find.

aballardaballard

You might want to post this on the ideaExchange (or if it is already there, vote it up....)

 

Ken_KoellnerKen_Koellner

I just voted up this one --https://sites.secure.force.com/success/ideaView?c=09a30000000D9xtAAC&id=08730000000BpoIAAS: https://sites.secure.force.com/success/ideaView?c=09a30000000D9xtAAC&id=08730000000BpoIAAS

 

They to already have the code to do the GUI elements as it works that way on the Event layout.

 

They just need VF tags for those and then you could connnect the to Date and Time Apex merge variables.

 

Vote early and vote often!!!

bob_buzzardbob_buzzard

Right behind you.  Although with a paltry 140 points it could be a long time coming.