Skip to content

Commit 1f74b23

Browse files
authored
OT Forms: fix max length issue and provide setting as a new feature
1 parent 58fd44f commit 1f74b23

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

open-ticket/ot-ticket-forms/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ The `questions` array defines the form's questions. Each question object include
4646
> For questions of type `short` or `long`:
4747
> - **`optional`**: A boolean indicating if the question is optional (`true`) or required (`false`).
4848
> - **`placeholder`**: A text placeholder for the response input (optional).
49+
> - **`maxLength`**: A number to set the max length size of the response (optional, default 1023).
4950
5051
> #### Dropdown-Specific Properties
5152
> For questions of type `dropdown`:
@@ -86,7 +87,8 @@ The `questions` array defines the form's questions. Each question object include
8687
"question": "That's an example of paragraph answer question?",
8788
"type": "long",
8889
"optional": false,
89-
"placeholder": "Multiple lines response, paragraphs allowed. (or leave it empty)"
90+
"placeholder": "Multiple lines response, paragraphs allowed. (or leave it empty)",
91+
"maxAnswerLength": 500
9092
},
9193
{
9294
"number": 4,

open-ticket/ot-ticket-forms/builders/modalBuilders.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ opendiscord.events.get("onModalBuilderLoad").listen((modals) => {
1919
style:question.type,
2020
required:!question.optional,
2121
placeholder:question.placeholder ? question.placeholder : undefined,
22+
maxLength: question.maxAnswerLength ?? 1023,
2223
});
2324
}
2425
})

open-ticket/ot-ticket-forms/config.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"question":"This is an example of a short answer question. You can add as many questions as you want.",
1515
"type":"short",
1616
"optional":false,
17-
"placeholder":"Single line response, no paragraphs allowed. (or leave it empty)"
17+
"placeholder":"Single line response, no paragraphs allowed. (or leave it empty)",
18+
"maxAnswerLength": 50
1819
},
1920
{
2021
"position":2,
@@ -84,7 +85,8 @@
8485
"question":"Question Nr1",
8586
"type":"paragraph",
8687
"optional":false,
87-
"placeholder":"the placeholder (or leave it empty)"
88+
"placeholder":"the placeholder (or leave it empty)",
89+
"maxAnswerLength": 250
8890
}
8991
]
9092
}

open-ticket/ot-ticket-forms/types/configDefaults.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export interface OTForms_ModalQuestion extends OTForms_Question {
5151
type: "short" | "paragraph",
5252
placeholder: string,
5353
optional: boolean,
54+
maxAnswerLength: number,
5455
}
5556

5657
/** ## OTForms_Choice `interface`
@@ -80,4 +81,4 @@ export interface OTForms_DropdownChoice extends OTForms_Choice {
8081
*/
8182
export class ODJsonConfig_DefaultForms extends api.ODJsonConfig {
8283
declare data: OTForms_Form[]
83-
}
84+
}

0 commit comments

Comments
 (0)