2020-04-04 07:04:25 -07:00
|
|
|
import { INodeProperties } from 'n8n-workflow';
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const formOperations: INodeProperties[] = [
|
2020-04-04 07:04:25 -07:00
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
noDataExpression: true,
|
2020-04-04 07:04:25 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
2020-04-06 01:03:49 -07:00
|
|
|
'form',
|
2020-04-04 07:04:25 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
2020-04-12 03:28:36 -07:00
|
|
|
name: 'Submit a Form',
|
2020-04-04 07:04:25 -07:00
|
|
|
value: 'submit',
|
2020-07-24 03:56:41 -07:00
|
|
|
description: 'Store data from a form submission',
|
2020-04-04 07:04:25 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
default: 'submit',
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|
2020-04-04 07:04:25 -07:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const formFields: INodeProperties[] = [
|
2020-04-05 06:49:47 -07:00
|
|
|
{
|
|
|
|
displayName: 'Form',
|
|
|
|
name: 'form',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
2020-04-06 01:03:49 -07:00
|
|
|
'form',
|
2020-04-05 06:49:47 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
required: true,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Name of the form to operate on',
|
2020-04-05 06:49:47 -07:00
|
|
|
},
|
|
|
|
|
2020-04-06 01:03:49 -07:00
|
|
|
// Form:submit
|
2020-04-04 07:04:25 -07:00
|
|
|
{
|
2020-04-11 11:24:58 -07:00
|
|
|
displayName: 'JSON Data fields',
|
|
|
|
name: 'jsonDataFields',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'form',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'submit',
|
2020-10-22 06:46:03 -07:00
|
|
|
],
|
2020-04-11 11:24:58 -07:00
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'If form fields should be set via the value-key pair UI or JSON',
|
2020-04-11 11:24:58 -07:00
|
|
|
},
|
|
|
|
{
|
2020-04-12 03:28:36 -07:00
|
|
|
displayName: 'Form Data',
|
2020-04-11 11:24:58 -07:00
|
|
|
name: 'dataFieldsJson',
|
2020-04-04 07:04:25 -07:00
|
|
|
type: 'json',
|
|
|
|
default: '',
|
|
|
|
typeOptions: {
|
|
|
|
alwaysOpenEditWindow: true,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2020-04-11 11:24:58 -07:00
|
|
|
jsonDataFields: [
|
|
|
|
true,
|
|
|
|
],
|
2020-04-04 07:04:25 -07:00
|
|
|
resource: [
|
2020-04-06 01:03:49 -07:00
|
|
|
'form',
|
2020-04-04 07:04:25 -07:00
|
|
|
],
|
2020-04-11 11:24:58 -07:00
|
|
|
operation: [
|
|
|
|
'submit',
|
2020-10-22 06:46:03 -07:00
|
|
|
],
|
2020-04-04 07:04:25 -07:00
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Form data to send as JSON',
|
2020-04-11 11:24:58 -07:00
|
|
|
},
|
|
|
|
{
|
2020-04-12 03:28:36 -07:00
|
|
|
displayName: 'Form Data',
|
2020-04-11 11:24:58 -07:00
|
|
|
name: 'dataFieldsUi',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
jsonDataFields: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
resource: [
|
|
|
|
'form',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'submit',
|
2020-10-22 06:46:03 -07:00
|
|
|
],
|
2020-04-11 11:24:58 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Field',
|
|
|
|
name: 'field',
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Name of the field',
|
2020-04-11 11:24:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Value',
|
|
|
|
name: 'value',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Value of the field',
|
2020-04-11 11:24:58 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Form data to send',
|
2020-04-04 07:04:25 -07:00
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|