Designing Contact Data Forms

Modified on Thu, 8 Jan at 12:51 PM

Designing Contact Data Forms

This page provides step-by-step instructions for incorporating participant contact details (e.g., name, email, mobile number, address, etc.) into a form in OC4, using both the Form Designer and the Form Template.

Overview

When you capture contact information in a form (for example, allowing a participant to update their phone number or email), OpenClinica 4 supports this through the special contactdata mechanism.

⚠️ Important: Contact data items behave differently from ordinary form data. They are stored in a participant contact record rather than in the study’s clinical data set, and they are subject to stricter access controls.

For more information on how contact data behaves in Study Runner, refer to Understanding Contact Data.


Access & Role Considerations

  • If any version of a form includes a contactdata item, the form is treated as a contact form.
  • By default, Clinical Research Coordinators (CRCs) and Investigators can view and edit contact forms. Manual permission tags can be used to override this default, granting access to non-CRCs/Investigators or revoking access for CRCs/Investigators.
    For details, see Managing Form Access and Permissions.
  • Contact data is stored as part of the participant record rather than as form data. Because of this, including contact data in form outputs would be redundant and may create a misleading impression of what was entered on a specific form. As a result, extract and API behavior differ from standard data forms.

Using Form Designer for Contact Data Items

For general instructions, see Using Form Designer.

  1. In Study Designer, open your form in Form Designer.
  2. Add a Text or other suitable item for each contact field you want to collect (for example, First Name, Email Address, Mobile Number).
  3. Remove Item Group Name—contact-data items cannot be placed in an item group.
  4. Set Use as External Value to contactdata.
  5. Select the type of contact data you are collecting from the available options:
    • firstname
    • lastname
    • email
    • mobilenumber
    • secondaryid

Using Form Template for Contact Data Items

For general instructions, see Using the Form Template.

  1. In the Survey sheet, add a row for each contact field.
  2. For each row, set:
    • type = the data type (for example, text)
    • label = the question text (for example, Mobile Phone Number)
    • name = the internal variable name (for example, mobile_number)
      • Used for referencing the item within the form (for example, relevant logic on another item to check whether it is blank or filled in)
    • bind::oc:external = contactdata
    • bind::oc:itemgroup = blank. Contact data items cannot be included in item groups.
  3. Add the column instance::oc:contactdata and enter one of the allowed values shown below.
  4. Configure other columns as needed (for example, required, relevant, etc).
    ℹ️ Note: Constraints for contact-data items are automatically applied by the system.
  5. Upload the file through the Form Card > Upload button and preview the form.

Formatting and Automatic Constraints

When a field is defined as contactdata, OpenClinica automatically applies type-specific constraints to ensure format and data quality.
These constraints are system-enforced—you do not need to define them manually in the Form Template.

Data TypeItem TypeAutomatic Constraint
firstnametextString length ≤ 35 characters
middlenametextString length ≤ 35 characters
lastnametextString length ≤ 35 characters
emailtextString length ≤ 255 characters and must match the following regular expression:
^[A-Za-z0-9!#$%&’*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&’*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?$
mobilenumbertextString length ≤ 17 characters and must match the following regular expression:
^\+[0-9]{1,3} [0-9]{1,14}$
Accepts either a full international format (e.g., +1 5551234567) or a 10-digit number (assumed country code +1).
streetaddress1textString length ≤ 155 characters
streetaddress2textString length ≤ 155 characters
countrytextString length ≤ 155 characters
citytextString length ≤ 155 characters
statetextString length ≤ 155 characters
postalcodetextString length ≤ 35 characters
fulldobdate(Date field; format defined by system locale—no explicit length constraint.)
secondaryidtextString length ≤ 35 characters
hospitalnumbertextString length ≤ 35 characters

ℹ️ Note: Mobile phone number is stored internally along with country code (for example +123 456789012345). Once a value has been collected, on either the form or from the Participant Details screen, it will be displayed in that format with country code (including +1 before US phone numbers).
Participants can enter phone numbers in either of the following formats:

  • + followed by country code, space, and number (e.g., +1 5551234567)
  • A 10-digit number (automatically assumed to be U.S. +1)

Notes on Constraints

  • The constraint, constraint message, and constraint type are automatically populated when the item is identified as contactdata.
  • If additional validation is needed (for example, regional phone number formats), use a separate constraint expression and validate thoroughly.
  • For mobile numbers, OpenClinica automatically stores the number with a “+” prefix and country code.

Example: Template Configuration

typenamelabelbind::oc:externalinstance::oc:contactdatarequired
textfirst_nameFirst Namecontactdatafirstnameyes
textlast_nameLast Namecontactdatalastnameyes
textemail_addressEmail Addresscontactdataemailyes
textmobile_phoneMobile Phone Numbercontactdatamobilenumberno
textmailing_street1Street Address Line 1contactdatastreetaddress1no
textmailing_cityCitycontactdatacityno
textmailing_postalPostal / ZIP Codecontactdatapostalcodeno

 


Summary and Best Practices

  • Use bind::oc:external = contactdata and the appropriate instance::oc:contactdata code for each contact data item.
  • Do not group contact-data items within an item group.
  • Validate key fields (e.g., email format, phone number) and mark required appropriately.
  • Do not add custom constraints that conflict with the system’s automatic rules.
  • Test the form in a test environment using the same role permissions that will apply in production.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article