In This Article:

    Allow dates like 8/5/2015 to be typed into date field

    In This Article:

      Background

      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:

      2015-08-07_0957.png

      When custom fields are clicked, a date selector dialog pops up.

      2015-08-07_0954.png

      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

      2015-08-07_1021.png

      and then have it appear in the correct format.

      2015-08-07_1023.png

      Like that? Read on!

      Solution

      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:

      1. Edit a template.
      2. Locate the </body> tag using the browser's search tool.
      3. Insert a blank line just before the </body> tag.
      4. Click here to see the solution source. 
      5. Click on the Raw button.  A window containing just the source solution will appear.
      6. Copy the contents of the window and close it.
      7. Paste the copied contents into the newly inserted line.
      8. Save the template.
      9. Test!

      Cautions

      Please keep these cautionary notes in mind when you use this script:

      1. The script only works on date custom field.  They don't work on any other kind of fields.
      2. If the script finds an invalid date then the date field is left empty.
      3. 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.)

      Questions?

      If you have any questions, please collection this information:

      • Your organization_KEY
      • Your chapter_KEY if you are in a chapter
      • The template_KEY of 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 support@salsalabs.com, and we'll be glad to help.

      Was this article helpful?
      0 out of 0 found this helpful
      Have more questions? Submit a request

      Comments

      0 comments

      Please sign in to leave a comment.