3 minute read
Christian Ståhl left me a good question in another post:
Have you tried to ‘formfill’ a SharePoint column for date and time with ‘today’s date’, that would be cool if its possibly?
Of course it’s possible! You can pre-fill any columns value based on rules which you decide. There are probably a few common situations:
- Passing values on the Query String to pre-fill column values. I have a post which talks a little about this scenarios already entitled Using Query String Variables to Populate SharePoint Form Fields. That post was fairly specific to a problem I was trying to solve, but it should give you the basic steps for other situations.
- Pre-filling based on some existing data (like the today’s date question above) . Let’s go through this scenario here.
Note that we need to add one to todayMon because the month values start at 0 for January. I’m also building up the value for today’s date in 1033 locale format because I live in the US – you would want to build this up in your locale’s format.