Salsa provides a way to create a field that collects a date. This is a date custom field, and it will appear in your list of custom fields looking like this:
When custom fields are clicked, a date selector dialog pops up.
If a supporter chooses a date using the selector, then everything is find and dandy. Salsa sets the field to a database-properly formatted date and the form gets submitted and data gets stored and all of that. But let's say that you're collecting a birthday. The selector becomes a real pain with all of the clicking that an adult has to do.
What we need is a way for a supporter to type in a date like a birthday
and then have it appear in the correct format.
Like that? Read on!
The solution is to install a script into your templates that are assigned to pages that collect dates. Here are some steps that you can use:
- Edit a template.
- Locate the
</body>tag using the browser's search tool.
- Insert a blank line just before the
- Click here to see the solution source.
- Click on the
Rawbutton. A window containing just the source solution will appear.
- Copy the contents of the window and close it.
- Paste the copied contents into the newly inserted line.
- Save the template.
Please keep these cautionary notes in mind when you use this script:
- The script only works on date custom field. They don't work on any other kind of fields.
- If the script finds an invalid date then the date field is left empty.
- The script supports a huge number of date formats. That means that putting in a date in an unusual format may not return the correct value. (Try '11-11-11' and '1911-11--11' to see this in action.)
If you have any questions, please collection this information:
chapter_KEYif you are in a chapter
template_KEYof the modified template
- The URL of a page with a date field that uses the modified template
- A screenshot if possible
Send this information to firstname.lastname@example.org, and we'll be glad to help.