Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/cli/templates/form-trigger.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
20 changes: 14 additions & 6 deletions packages/nodes-base/nodes/Form/FormTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,28 @@ export class FormTrigger implements INodeType {
description: 'The type of field to add to the form',
options: [
{
name: 'Text',
value: 'text',
name: 'Date',
value: 'date',
},
{
name: 'Dropdown List',
value: 'dropdown',
},
{
name: 'Number',
value: 'number',
},
{
name: 'Date',
value: 'date',
name: 'Password',
value: 'password',
},
{
name: 'Dropdown List',
value: 'dropdown',
name: 'Text',
value: 'text',
},
{
name: 'Textarea',
value: 'textarea',
},
],
required: true,
Expand Down
1 change: 1 addition & 0 deletions packages/nodes-base/nodes/Form/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type FormField = {
export type FormTriggerInput = {
isSelect?: boolean;
isMultiSelect?: boolean;
isTextarea?: boolean;
isInput?: boolean;
labbel: string;
id: string;
Expand Down
2 changes: 2 additions & 0 deletions packages/nodes-base/nodes/Form/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down