feat(n8n Form Trigger Node): Add text area and password input types (#7474)

Signed-off-by: yoshino-s <cy-cui@outlook.com>
This commit is contained in:
Yoshino-s 2023-11-01 20:23:28 +08:00 committed by GitHub
parent ce14f6266b
commit b72040aa54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 8 deletions

View file

@ -283,6 +283,20 @@
</div>
{{/if}}
{{#if isTextarea}}
<div class='form-group'>
<label class='form-label' for='{{id}}'>{{label}}</label>
<textarea
class='form-input {{inputRequired}}'
id='{{id}}'
name='{{id}}'
></textarea>
<p class='{{errorId}} error-hidden'>
This field is required
</p>
</div>
{{/if}}
{{#if isInput}}
<div class='form-group'>
<label class='form-label' for='{{id}}'>{{label}}</label>

View file

@ -106,14 +106,6 @@ export class FormTrigger implements INodeType {
default: 'text',
description: 'The type of field to add to the form',
options: [
{
name: 'Text',
value: 'text',
},
{
name: 'Number',
value: 'number',
},
{
name: 'Date',
value: 'date',
@ -122,6 +114,22 @@ export class FormTrigger implements INodeType {
name: 'Dropdown List',
value: 'dropdown',
},
{
name: 'Number',
value: 'number',
},
{
name: 'Password',
value: 'password',
},
{
name: 'Text',
value: 'text',
},
{
name: 'Textarea',
value: 'textarea',
},
],
required: true,
},

View file

@ -9,6 +9,7 @@ export type FormField = {
export type FormTriggerInput = {
isSelect?: boolean;
isMultiSelect?: boolean;
isTextarea?: boolean;
isInput?: boolean;
labbel: string;
id: string;

View file

@ -52,6 +52,8 @@ export const prepareFormData = (
input.isSelect = true;
const fieldOptions = field.fieldOptions?.values ?? [];
input.selectOptions = fieldOptions.map((e) => e.option);
} else if (fieldType === 'textarea') {
input.isTextarea = true;
} else {
input.isInput = true;
input.type = fieldType as 'text' | 'number' | 'date';