---
title: Carry Forward Responses
product: Form Library
description: Carry forward responses let you copy selected or non-selected answers from one question to another question. View this free demo example for JavaScript and learn how to use carry forward choices in a web form.
framework: jQuery
source: https://surveyjs.io/form-library/examples/carry-forward-responses/jquery
index: https://surveyjs.io/form-library/examples/overview.md
---

# Carry Forward Responses (jQuery)

The Carry Forward Responses feature allows you to copy choices from one question (the source) to another (the target). You can choose to copy selected, unselected, or all choices. In this demo, you are asked to select at least two smartphone features. They will be copied to the next question where you can rank them in order of importance.

## Supported Question Types

Carry Forward Responses can be used with the following question types:

- [Checkbox](https://surveyjs.io/form-library/examples/questiontype-checkbox/)
- [Dropdown](https://surveyjs.io/form-library/examples/questiontype-dropdown/)
- [Image Picker](https://surveyjs.io/form-library/examples/image-picker-question/)
- [Radio Group](https://surveyjs.io/form-library/examples/questiontype-radiogroup/)
- [Ranking](https://surveyjs.io/form-library/examples/questiontype-ranking/)
- [Tag Box](https://surveyjs.io/form-library/examples/how-to-create-multiselect-tag-box/)

## Configure the Source Question

The source question should define the [`choices`](https://surveyjs.io/form-library/documentation/api-reference/questionselectbase#choices) array. To learn how to configure this array for a question type of your choice, follow the links listed in the Supported Question Types section.

## Configure the Target Question

To carry forward choices from a source question, assign its [`name`](https://surveyjs.io/form-library/documentation/api-reference/surveyelement#name) to the [`choicesFromQuestion`](https://surveyjs.io/form-library/documentation/api-reference/questionselectbase#choicesFromQuestion) property of a target question. If you want to copy only selected or unselected choices, set the [`choicesFromQuestionMode`](https://surveyjs.io/form-library/documentation/api-reference/questionselectbase#choicesFromQuestionMode) property to `"selected"` or `"unselected"`. This demo shows how to carry forward selected choices.

If you choose to carry forward selected or unselected choices, their number may become zero. In this case, the target question displays only its title, but you can hide the entire question instead. Enable the [`hideIfChoicesEmpty`](https://surveyjs.io/form-library/documentation/api-reference/questionselectbase#hideIfChoicesEmpty) property or specify the [`visibleIf`](https://surveyjs.io/form-library/documentation/api-reference/question#visibleIf) expression. When the expression evaluates to `false`, the target question becomes invisible. In this demo, the question hides if you select one or no choices from the source question.

## 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 "./index.css";
import { json } from "./json";

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

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

### `src/json.js`

```js
export const json = {
  "elements": [{
    "type": "checkbox",
    "name": "smartphone-features",
    "title": "Which features do you value most in a smartphone?",
    "description": "Please select at least TWO features to see the Carry Forward functionality.",
    "isRequired": true,
    "colCount": 2,
    "choices": [
      "Long battery life",
      "Plenty of storage capacity",
      "High-quality camera",
      "Powerful CPU",
      "Large screen size",
      "High durability",
      "Low price"
    ]
  }, {
    "type": "ranking",
    "name": "smartphone-features-ranked",
    "title": "Please rank the selected features from the most important to the least",
    "visibleIf": "{smartphone-features.length} > 1",
    "isRequired": true,
    "choicesFromQuestion": "smartphone-features",
    "choicesFromQuestionMode": "selected"
  }]
};
```

### `src/theme.js`

```js
export const themeJson = {};
```

### `package.json`

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

## Other Frameworks

- [Angular](https://surveyjs.io/form-library/examples/carry-forward-responses/angular.md)
- [React](https://surveyjs.io/form-library/examples/carry-forward-responses/reactjs.md)
- [Vue 3](https://surveyjs.io/form-library/examples/carry-forward-responses/vue3js.md)
- [Vanilla JS](https://surveyjs.io/form-library/examples/carry-forward-responses/vanillajs.md)
