> For the complete documentation index, see [llms.txt](https://help.ica.illumina.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.ica.illumina.com/project/p-flow/f-pipelines/json-based-input-forms/onsubmit.js.md).

# onSubmit.js

The onSubmit.js javascript function receives an input object which holds information about the chosen values of the input form and the pipeline and pipeline execution request parameters. This javascript function is not only triggered when submitting a new pipeline execution request in the user interface, but also when submitting one through the rest API..

#### Input parameters

<table><thead><tr><th width="210">Value</th><th>Meaning</th></tr></thead><tbody><tr><td>settings</td><td>The value of the setting fields. Corresponds to <code>settingValues</code> in the onRender.js. This is a map with field id as key and an array of field values as value. For convenience, values of single-value fields are present as the individual value and not as an array of length 1. In case of fieldGroups, the value can be multiple levels of arrays. For fields of type <em>data</em> the values in the json are data ids (fil.xxxx). To help with validation, these are expanded and made available as an object here containing the <em>id</em>, <em>name</em>, <em>path</em>, <em>format</em>, <em>size</em> and a boolean indicating whether the data is <em>external</em>. This info can be used to validate or pick the chosen storageSize.</td></tr><tr><td>settingValues</td><td>To maximize the opportunity for reusing code between onRender and onSubmit, the 'settings' are also exposed as <code>settingValues</code> like in the onRender input.</td></tr><tr><td>pipeline</td><td>Info about the pipeline: code, tenant, and description are all available in the pipeline object as string.</td></tr><tr><td>analysis</td><td>Info about this run: userReference, userName, and userTenant are all available in the analysis object as string.</td></tr><tr><td>storageSize</td><td>The storage size as chosen by the user. This will initially be null. StorageSize is an object containing an 'id' and 'name' property.</td></tr><tr><td>storageSizeOptions</td><td>The list of storage sizes available to the user when creating an analysis. Is a list of StorageSize objects containing an 'id' and 'name' property.</td></tr><tr><td>analysisSettings</td><td>The input form json as saved in the pipeline. So the original json, without eventual changes.</td></tr><tr><td>currentAnalysisSettings</td><td>The current input form JSON as rendered to the user. This can contain already applied changes form earlier onRender passes. Null in the first call, when context is 'Initial' or when analysis is created through CLI/API.</td></tr></tbody></table>

#### Return values (taken from the response object)

<table><thead><tr><th width="191">Value</th><th>Meaning</th></tr></thead><tbody><tr><td>settings</td><td>The value of the setting fields. This allows modifying the values or applying defaults and such. Or taking info of the pipeline or analysis input object. When settings are not present in the onSubmit return value object, they are assumed to be not modified.</td></tr><tr><td>validationErrors</td><td>A list of AnalysisError essages representing validation errors. <strong>Submitting a pipeline execution request is not possible while there are still validation errors.</strong></td></tr><tr><td>analysisSettings</td><td>The input form json with potential applied changes. The discovered changes will be applied in the UI when viewing the analysis.</td></tr></tbody></table>

#### AnalysisError

This is the object used for representing validation errors.

<table><thead><tr><th width="204">Value</th><th>Meaning</th></tr></thead><tbody><tr><td>fieldId / FieldId</td><td>The field which has an erroneous value. When not present, a general error/warning is displayed. To display an error on the storage size, use the <code>storageSize</code>Fieldid.</td></tr><tr><td>index / Index</td><td>The 0-starting index of the value which is incorrect. Use this when a particular value of a multivalue field is not correct. When not present, the entire field is marked as erroneous. The value can also be an array of indexes for use with fieldgroups. For instance, when the 3rd field of the 2nd instance of a fieldgroup is erroneous, a value of [ 1 , 2 ] is used.</td></tr><tr><td>message / Message</td><td>The error/warning message to display.</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.ica.illumina.com/project/p-flow/f-pipelines/json-based-input-forms/onsubmit.js.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
