---
title: Patient Registration Form
product: Form Library
description: Explore this free patient registration form template with a ready-to-use code example for JavaScript. The form demonstrates some practical features, like image capture to take photos within the form, a dynamic dropdown with a search-as-you-type option, and user-friendly form flow with conditional logic. You can embed the form in your app as-is or enhance it even further with our free form editing tool.
framework: jQuery
source: https://surveyjs.io/form-library/examples/patient-registration-form-template-free/jquery
index: https://surveyjs.io/form-library/examples/overview.md
---

# Patient Registration Form (jQuery)

<!-- cut -->

A patient registration form helps healthcare facilities (hospitals, clinics, medical practices) collect information from individuals seeking medical care. As a rule, patient registration forms request personal information (full name, birthdate, gender, contact details), insurance information, and emergency contacts. This example demonstrates a sample patient registration form, which was fully created and designed using Survey Creator by SurveyJS. In the sections below, we'll give an overview of key solutions implemented in this form.

## Configure the Form Header

A form header usually consists of a form title, short description, and a logo of your company. It can also display a background image different from the background image of the rest of the form. This section describes how to configure these features.

### Add a Form Title, Description, and Logo

You can specify a form title and description in the Designer tab of Survey Creator. Enter title and description texts in the **Survey title** and **Survey description** editors in the **General** category.

<img src="/Content/Images/examples/featured-demos/survey-title-and-description.png" alt="Specify survey title and description in SurveyJS Survey Creator" width="100%">

To configure a logo, use editors in the **Logo in the Survey Header** category.

<img src="/Content/Images/examples/featured-demos/logo-settings.png" alt="Specify logo in SurveyJS Survey Creator" width="100%">

These editors are mapped to the following survey JSON properties:

- [`title`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#title)
- [`description`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#description)
- [`logo`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#logo)
- [`logoWidth`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#logoWidth)
- [`logoHeight`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#logoHeight)
- [`logoFit`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#logoFit)

To position a title and description within a form header, use Theme Editor integrated in Survey Creator. Open the Themes tab, switch to the **Header** category in Property Grid, and use the **Logo alignment**, **Survey title alignment**, and **Survey description alignment** editors to align these elements as required. Ensure that the **View** switch is set to "Advanced".

<img src="/Content/Images/examples/featured-demos/title-description-logo-position.png" alt="Specify the positions of title, description, and logo in SurveyJS Survey Creator" width="100%">

### Add a Background Image to the Form Header

A form header can display a background image that gives your form a more professional look. To add a background image using Theme Editor, open the **Header** category in Property Grid, switch the **View** editor to "Advanced", and use the **Background image** editors.

<img src="/Content/Images/examples/featured-demos/header-background-image.png" alt="Specify a background image for a form header in SurveyJS Survey Creator" width="100%">

The **Background image** editors are mapped to the following properties in the theme JSON schema (see the `theme.js` file):

- [`header`](https://surveyjs.io/form-library/documentation/api-reference/itheme#header).[`backgroundImage`](https://surveyjs.io/form-library/documentation/api-reference/iheader#backgroundImage)
- [`header`](https://surveyjs.io/form-library/documentation/api-reference/itheme#header).[`backgroundImageOpacity`](https://surveyjs.io/form-library/documentation/api-reference/iheader#backgroundImageOpacity)
- [`header`](https://surveyjs.io/form-library/documentation/api-reference/itheme#header).[`backgroundImageFit`](https://surveyjs.io/form-library/documentation/api-reference/iheader#backgroundImageFit)

### Specify the Header Content Width

The content area of a form header can have the same width as form contents or span the width of the form container, as in this demo. To specify the preferred mode, use the **Header** > **Content area width** editor, which is mapped to the [`header`](https://surveyjs.io/form-library/documentation/api-reference/itheme#header).[`inheritWidthFrom`](https://surveyjs.io/form-library/documentation/api-reference/iheader#inheritWidthFrom) property.

<img src="/Content/Images/examples/featured-demos/header-content-area-width.png" alt="Specify form header width in SurveyJS Survey Creator" width="100%">

## Enable Image Capture

A patient registration form may include a patient's photo. To let users take the photo directly inside the form, add a File Upload question to the designer surface and set the question's **File source type** to "Camera" or "Local file or Camera".

<img src="/Content/Images/examples/featured-demos/file-upload-source-type.png" alt="Enable image capture in SurveyJS Survey Creator" width="100%">

[View Photo Capture Demo](https://surveyjs.io/form-library/examples/photo-capture/ (linkStyle))

## Add Conditional Logic and Branching

Conditional logic allows you to add and remove optional questions based on answers given to other questions. In this example, when you select "Other" in the Policyholder question, the form displays additional fields that solicit information about the insurance policyholder. To implement this logic, we set a **Make the question visible if** rule for each additional question. In the survey JSON schema, this rule is saved in the question's [`visibleIf`](https://surveyjs.io/form-library/documentation/api-reference/checkbox-question-model) property.

<img src="/Content/Images/examples/featured-demos/visibleif.png" alt="Implement conditional visibility in SurveyJS Survey Creator" width="100%">

For more information on conditional logic and branching, refer to the following help topic: [Conditional Logic and Dynamic Texts](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic).

## Files

### `public/index.html`

```html
<div id="surveyElement" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; min-height: 100%; height:100%"></div>
```

### `src/index.css`

```css
/* You can add your custom CSS here. */
```

### `src/index.js`

```js
import $ from "jquery";
import { Model } from "survey-core";
import "survey-js-ui";
import "survey-core/survey-core.min.css";
import { themeJson } from "./theme";
import "./index.css";
import { json } from "./json";

const survey = new Model(json);
survey.applyTheme(themeJson);
survey.onComplete.add((sender, options) => {
    console.log(JSON.stringify(sender.data, null, 3));
});

$("#surveyElement").Survey({ model: survey });
```

### `src/json.js`

```js
export const json = {
  "title": "Patient Registration Form",
  "description": "Your privacy is important to us. All information received through our forms and other communications is subject to our Patient Privacy Policy.",
  "logo": "https://api.surveyjs.io/private/Surveys/files?name=09b0ee2a-d256-4376-b328-8be12d868f14",
  "logoWidth": "auto",
  "logoHeight": "96",
  "completedHtml": "<div style=\"max-width:540px;text-align:left;margin:0px auto 16px auto;border: 1px solid rgba(0,0,0,0.25);padding:40px 48px 48px 48px;background-color:#fff;\">\n\n<h4>Thank you for completing your patient registration form.</h4>\n<br>\n<p>Dear {firstname-for-complete-page},\n<br>\nYour information has been successfully received, and we look forward to providing you with the highest level of care. \n<br><br>\nIf you have any questions or need to schedule an appointment, please don't hesitate to reach out to our office. Our team is here to assist you every step of the way.\n<br><br>\nWarm regards,\n<br>\nCentral Hospital.</p>\n\n</div>",
  "pages": [
    {
      "name": "page1",
      "elements": [
        {
          "type": "panel",
          "name": "personal-information",
          "elements": [
            {
              "type": "text",
              "name": "first-name",
              "width": "50%",
              "minWidth": "256px",
              "title": "First Name"
            },
            {
              "type": "text",
              "name": "last-name",
              "width": "50%",
              "minWidth": "256px",
              "startWithNewLine": false,
              "title": "Last Name"
            },
            {
              "type": "text",
              "name": "ssn",
              "width": "50%",
              "minWidth": "256px",
              "title": "Social Security #"
            },
            {
              "type": "text",
              "name": "birthdate",
              "width": "50%",
              "minWidth": "256px",
              "startWithNewLine": false,
              "title": "Date of Birth",
              "inputType": "date"
            },
            {
              "type": "dropdown",
              "name": "marital-status",
              "width": "50%",
              "minWidth": "256px",
              "title": "Marital Status",
              "choices": [ "Single", "Married", "Widowed", "Divorced", "Separated" ],
              "choicesOrder": "random",
              "placeholder": "",
              "allowClear": false
            },
            {
              "type": "dropdown",
              "name": "gender",
              "width": "50%",
              "minWidth": "256px",
              "startWithNewLine": false,
              "title": "Gender",
              "choices": [ "Male", "Female" ],
              "choicesOrder": "random",
              "placeholder": "",
              "allowClear": false
            }
          ],
          "width": "69%",
          "minWidth": "256px"
        },
        {
          "type": "file",
          "name": "photo",
          "width": "31%",
          "imageWidth": "532",
          "imageHeight": "576",
          "minWidth": "256px",
          "startWithNewLine": false,
          "titleLocation": "hidden",
          "sourceType": "camera",
          "photoPlaceholder": " "
        },
        {
          "type": "panel",
          "name": "contact-information",
          "elements": [
            {
              "type": "text",
              "name": "address",
              "width": "66%",
              "minWidth": "256px",
              "title": "Address"
            },
            {
              "type": "text",
              "name": "apartment-number",
              "width": "34%",
              "minWidth": "128px",
              "startWithNewLine": false,
              "title": "Apartment #"
            },
            {
              "type": "text",
              "name": "city",
              "width": "34%",
              "minWidth": "128px",
              "title": "City"
            },
            {
              "type": "text",
              "name": "state",
              "width": "32%",
              "minWidth": "128px",
              "startWithNewLine": false,
              "title": "State"
            },
            {
              "type": "text",
              "name": "zip",
              "width": "34%",
              "minWidth": "128px",
              "startWithNewLine": false,
              "title": "Zip Code"
            },
            {
              "type": "text",
              "name": "phone",
              "width": "34%",
              "minWidth": "128px",
              "title": "Phone #"
            },
            {
              "type": "text",
              "name": "email",
              "width": "66%",
              "minWidth": "256px",
              "startWithNewLine": false,
              "title": "Email Address"
            }
          ],
          "title": "Contact Information",
          "width": "100%",
          "minWidth": "256px"
        },
        {
          "type": "panel",
          "name": "emergency-contact",
          "elements": [
            {
              "type": "text",
              "name": "emergency-contact-full-name",
              "width": "66%",
              "minWidth": "256px",
              "title": "Full Name"
            },
            {
              "type": "dropdown",
              "name": "emergency-contact-relationship",
              "width": "34%",
              "minWidth": "128px",
              "startWithNewLine": false,
              "title": "Relationship",
              "choices": [ "Family Member", "Friend", "Partner", "Work Colleague" ], 
              "choicesOrder": "random",
              "placeholder": "",
              "allowClear": false
            },
            {
              "type": "text",
              "name": "emergency-contact-phone",
              "width": "34%",
              "minWidth": "128px",
              "title": "Phone #"
            },
            {
              "type": "text",
              "name": "emergency-contact-address",
              "width": "66%",
              "minWidth": "256px",
              "startWithNewLine": false,
              "title": "Address"
            }
          ],
          "title": "Emergency Contact Information",
          "width": "100%",
          "minWidth": "256px"
        },
        {
          "type": "panel",
          "name": "insurance",
          "elements": [
            {
              "type": "text",
              "name": "insurance-company",
              "width": "66%",
              "minWidth": "256px",
              "title": "Insurance Company"
            },
            {
              "type": "text",
              "name": "insurance-policy-number",
              "width": "34%",
              "minWidth": "128px",
              "startWithNewLine": false,
              "title": "Policy #"
            },
            {
              "type": "radiogroup",
              "name": "insurance-policyholder",
              "width": "100%",
              "minWidth": "256px",
              "title": "Policyholder",
              "defaultValue": "Personal",
              "choices": [ "Personal", "Other" ],
              "colCount": 0
            },
            {
              "type": "text",
              "name": "policyholder-name",
              "visibleIf": "{insurance-policyholder} = 'Other'",
              "width": "66%",
              "minWidth": "256px",
              "title": "Holder Name"
            },
            {
              "type": "dropdown",
              "name": "policyholder-relationship",
              "visibleIf": "{insurance-policyholder} = 'Other'",
              "width": "34%",
              "minWidth": "128px",
              "startWithNewLine": false,
              "title": "Relationship",
              "choicesFromQuestion": "emergency-contact-relationship",
              "choicesOrder": "random",
              "placeholder": "",
              "allowClear": false
            },
            {
              "type": "text",
              "name": "policyholder-birthdate",
              "visibleIf": "{insurance-policyholder} = 'Other'",
              "width": "34%",
              "minWidth": "128px",
              "title": "Date of Birth",
              "inputType": "date"
            },
            {
              "type": "text",
              "name": "policyholder-ssn",
              "visibleIf": "{insurance-policyholder} = 'Other'",
              "width": "32%",
              "minWidth": "128px",
              "startWithNewLine": false,
              "title": "Social Security #"
            },
            {
              "type": "text",
              "name": "policyholder-phone",
              "visibleIf": "{insurance-policyholder} = 'Other'",
              "width": "34%",
              "minWidth": "128px",
              "startWithNewLine": false,
              "title": "Phone #"
            },
            {
              "type": "comment",
              "name": "policyholder-address",
              "visibleIf": "{insurance-policyholder} = 'Other'",
              "width": "100%",
              "minWidth": "256px",
              "title": "Address",
              "autoGrow": true,
              "allowResize": false
            }
          ],
          "title": "Insurance Information",
          "width": "100%",
          "minWidth": "256px"
        }
      ]
    }
  ],
  "calculatedValues": [{
    "name": "firstname-for-complete-page",
    "expression": "iif({first-name} notempty, {first-name}, patient)"
  }],
  "questionErrorLocation": "bottom",
  "completeText": "Register",
  "questionsOnPageMode": "singlePage",
  "widthMode": "static",
  "width": "1024"
};
```

### `src/theme.js`

```js
export const themeJson = {
  "cssVariables": {
    "--sjs-general-backcolor": "rgba(255, 255, 255, 1)",
    "--sjs-general-backcolor-dark": "rgba(248, 248, 248, 1)",
    "--sjs-general-backcolor-dim": "#F6F4EE",
    "--sjs-general-backcolor-dim-light": "rgba(255, 255, 255, 1)",
    "--sjs-general-backcolor-dim-dark": "rgba(243, 243, 243, 1)",
    "--sjs-general-forecolor": "rgba(0, 0, 0, 0.91)",
    "--sjs-general-forecolor-light": "rgba(0, 0, 0, 0.45)",
    "--sjs-primary-backcolor": "rgba(0, 0, 0, 1)",
    "--sjs-primary-backcolor-light": "rgba(0, 0, 0, 0.1)",
    "--sjs-primary-backcolor-dark": "rgba(0, 0, 0, 0.5)",
    "--sjs-primary-forecolor": "rgba(255, 255, 255, 1)",
    "--sjs-primary-forecolor-light": "rgba(255, 255, 255, 0.25)",
    "--sjs-base-unit": "8px",
    "--sjs-corner-radius": "0px",
    "--sjs-shadow-small": "inset 0px 0px 0px 1px rgba(0, 0, 0, 0.25)",
    "--sjs-shadow-medium": "0px 2px 6px 0px rgba(0, 0, 0, 0.1)",
    "--sjs-shadow-large": "0px 8px 16px 0px rgba(0, 0, 0, 0.1)",
    "--sjs-shadow-inner": "inset 0px 0px 0px 1px rgba(0, 0, 0, 0.25), 0px 0px 0px 4px rgba(0, 0, 0, 0.05)",
    "--sjs-border-light": "rgba(0, 0, 0, 0.25)",
    "--sjs-border-default": "rgba(0, 0, 0, 0.25)",
    "--sjs-border-inside": "rgba(0, 0, 0, 0.16)",
    "--sjs-special-red": "rgba(229, 10, 62, 1)",
    "--sjs-special-red-light": "rgba(229, 10, 62, 0.1)",
    "--sjs-special-red-forecolor": "rgba(255, 255, 255, 1)",
    "--sjs-special-green": "rgba(25, 179, 148, 1)",
    "--sjs-special-green-light": "rgba(25, 179, 148, 0.1)",
    "--sjs-special-green-forecolor": "rgba(255, 255, 255, 1)",
    "--sjs-special-blue": "rgba(67, 127, 217, 1)",
    "--sjs-special-blue-light": "rgba(67, 127, 217, 0.1)",
    "--sjs-special-blue-forecolor": "rgba(255, 255, 255, 1)",
    "--sjs-special-yellow": "rgba(255, 152, 20, 1)",
    "--sjs-special-yellow-light": "rgba(255, 152, 20, 0.1)",
    "--sjs-special-yellow-forecolor": "rgba(255, 255, 255, 1)",
    "--sjs-editorpanel-hovercolor": "rgba(246, 244, 238, 1)",
    "--sjs-font-questiontitle-color": "rgba(0, 0, 0, 1)",
    "--sjs-font-editorfont-color": "rgba(0, 0, 0, 1)",
    "--sjs-font-editorfont-placeholdercolor": "rgba(0, 0, 0, 0.5)",
    "--sjs-questionpanel-hovercolor": "rgba(246, 244, 238, 1)",
    "--sjs-font-surveytitle-size": "28px",
    "--sjs-font-questiontitle-weight": "400",
    "--sjs-font-editorfont-size": "15px",
    "--sjs-font-questiondescription-size": "15px",
    "--sjs-font-questiontitle-size": "15px",
    "--sjs-font-questiondescription-color": "rgba(0, 0, 0, 0.5)",
    "--sjs-header-backcolor": "transparent",
    "--sjs-font-headertitle-color": "rgba(255, 255, 255, 1)",
    "--sjs-font-headerdescription-color": "rgba(255, 255, 255, 1)",
    "--sjs-font-headertitle-size": "24px",
    "--sjs-font-headertitle-weight": "600",
    "--sjs-font-headerdescription-size":  "15px",
    "--sjs-font-pagetitle-weight":  "700"
  },
    "isPanelless": true,
    "themeName": "default",
    "colorPalette": "light",
    "header": {
        "height": 320,
        "inheritWidthFrom": "container",
        "textAreaWidth": 424,
        "backgroundImage": "https://api.surveyjs.io/private/Surveys/files?name=3ed1681f-324e-4bdf-8bc9-a4058fc2075f",
        "backgroundImageOpacity": 1,
        "backgroundImageFit": "cover",
        "logoPositionX": "right",
        "logoPositionY": "top",
        "titlePositionX": "left",
        "titlePositionY": "bottom",
        "descriptionPositionX": "left",
        "descriptionPositionY": "bottom"
    },
    "headerView": "advanced"
};
```

### `package.json`

```json
{
  "dependencies": {
    "jquery": "latest",
    "survey-core": "latest",
    "survey-js-ui": "latest"
  }
}
```

## Other Frameworks

- [Angular](https://surveyjs.io/form-library/examples/patient-registration-form-template-free/angular.md)
- [React](https://surveyjs.io/form-library/examples/patient-registration-form-template-free/reactjs.md)
- [Vue 3](https://surveyjs.io/form-library/examples/patient-registration-form-template-free/vue3js.md)
- [Vanilla JS](https://surveyjs.io/form-library/examples/patient-registration-form-template-free/vanillajs.md)
