The Date Select Field


The date select field enables users to point and click in order to select a date.

Date Select Attributes and Terminology

The date select field (like other Identity Cloud fields) provides a number of attributes you can use when creating and formatting the field. Also like other Identity Cloud fields, the terminology used to represent these attributes in Console’s Registration Builder sometimes differs from the terminology required when using the Configuration APIs, which, in turn, sometimes differs from the terminology used if you view the underlying flow. 

Needless to say, that can be confusing at times. With that in mind, the following table shows the different date select attributes and how they are referenced in Registration Builder, the Configuration API, and the flow; click the appropriate link in the flow column for more information about that attribute. Attributes highlighted in yellow are auto-generated when the field is created, and shouldn’t be referenced when making an API call (and can’t be accessed through Registration Builder).

Option used in Registration Builder

Parameter used when making an API call

Property name used in the flow

Name

name

name

Field Type

type

type

Schema Attribute

schemaAttribute

schemaId

Label

label

label

Tip

tip

tip

Date Format

dateFormat

format

Submit blank field values as null

emptyMeansNull

emptyMeansNull

Ignore updates submitted to this field

ignoreUpdate

ignoreUpdate

Start Year

yearStart

yearStart

End Year

yearEnd

yearEnd

Data Validations

validation

validation

Forms

forms

forms


dayLabel

customText : dayLabelDateSelect


monthLabel

customText: monthLabelDateSelect


yearLabel

customText: yearLabelDateSelect


monthNames

monthNames



element


Creating a Date Select Field by Using the Configuration API

If you’re using the Configuration APIs to create a date select field, you must include all the desired attributes and attribute values within the body parameter of your API call. That body parameter will look similar to one shown below (depending, of course, on the number of attributes you use). In the following example, required attributes are shown in red:

{
     "name": "birthdate",
     "schemaAttribute": "birthday",
     "type": "dateselect",
     "ignoreUpdate": false,
     "emptyMeansNull": true,
     "startYear": "1989",
     "endYear": "2020",
     "dateFormat": "dd/mm/yyyy",
     "label": {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     },
     "tip": {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     },
     "yearLabel": {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     },
     "monthLabel": {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     },
     "dayLabel": {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     },
     "monthNames": [{
          "key": "50ee3f638fb5eb583ce96065128c383b"
     }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
     }]
}

If you’re using Postman, your body parameter will look like this:

There are at least three things to keep in mind when creating the body parameter:

  • The parameter must be formatted using JSON (JavaScript Object Notation). If you get the following error, that often means that your body parameter isn’t using valid JSON:
    400 Bad Request. The browser (or proxy) sent a request that this server could not understand.
  • The label and tip attributes must be formatted as JSON objects; that is, you must start with the attribute name (e.g., tip) followed by a colon and a set of curly braces ({ }). Inside those curly braces, use the key parameter followed by the id of a translation key containing the text you want to use for the label/tip. For example:
    "label": {"key": "352a99f1e9442568706468966749f1e9"}
    Note that you must reference a translation key (i.e., a  previously-defined piece of text) when creating a label or tip. Suppose you try defining your text within the API call:
    "label": "Start Date"
    That’s going to result in an invalid syntax error. Instead, use the ID of an existing translation key. If you don't have a translation key that uses the string Start Date, you'll need to create one before you can create the radio buttons field.

    This same approach is required if you want to change the Month, Day, and Year labels used by the control.

  • The forms attribute must be formatted as a JSON array, with the form names configured as a comma-separated list between square brackets. For example,
    "forms": ["traditionalRegistrationForm", "socialRegistrationForm"]

Another thing to keep in mind is this: specifying custom month names requires you to use a JSON array in which January is month 0 and December is month 11. To change month names you must include the monthNames attribute along with all 12 months, even if you only want to change the name of one month. For example, suppose you want to change the name of the month for March (for whatever reason). If you list only one parameter in your API call, the endpoint will change the month name for January. That's because it takes the first name in your list of month names and assigns that name to January. Note, too that – like the label and tip attributes – month names require you to reference a translation key:

{"key": "50ee3f638fb5eb583ce96065128c383b"},

A complete Curl command for creating a date select field will look similar to this:

curl -L -X POST \
  'https://v1.api.us.janrain.com/config/79y4mqf2rt3bxs378kw5479xdu/flows/fieldExamples/fields' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Basic eTR4Zmc2ZjQ0bXNhYzN2ZXBqanZ4Z2d6dnQzZTNzazk6OTVjY3hrN2N6YnZ1eng2ZHB0ZTVrOXA2ZGo1Ynpla3U=' \
  --data-raw '{
     "name": "birthdate",
     "schemaAttribute": "birthday",
     "type": "dateselect",
     "ignoreUpdate": false,
     "emptyMeansNull": true,
     "startYear": "1989",
     "endYear": "2020",
     "dateFormat": "dd/mm/yyyy",
     "label": {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       },
     "tip": {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       },
     "yearLabel": {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       },
     "monthLabel": {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       },
     "dayLabel": {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       },
     "monthNames": [{
          "key": "50ee3f638fb5eb583ce96065128c383b"
       }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       }, {
          "key": "50ee3f638fb5eb583ce96065128c383b"
       }]
}'