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

feature/add_markdown_to_forms #809

Merged
merged 4 commits into from
Feb 11, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
('create_new', 'In a multiselect with a dropdown, this option allows the user to enter new values, that are not in the list of options.', 'BOOLEAN', FALSE, TRUE),
('step', 'The increment of values in an input of type number. Set to 1 to allow only integers.', 'REAL', FALSE, TRUE),
('description', 'A helper text to display near the input field.', 'TEXT', FALSE, TRUE),
('description_md', 'A helper text to display near the input field - formatted using markdown.', 'TEXT', FALSE, TRUE),
('pattern', 'A regular expression that the value must match. For instance, [0-9]{3} will only accept 3 digits.', 'TEXT', FALSE, TRUE),
('autofocus', 'Automatically focus the field when the page is loaded', 'BOOLEAN', FALSE, TRUE),
('width', 'Width of the form field, between 1 and 12.', 'INTEGER', FALSE, TRUE),
Expand Down Expand Up @@ -339,7 +340,7 @@ When loading the page, the value for `:username` will be `NULL` if no value has
'{"name": "Last name", "required": true, "description": "We need your last name for legal purposes."},'||
'{"name": "Resume", "type": "textarea"},'||
'{"name": "Birth date", "type": "date", "max": "2010-01-01", "value": "1994-04-16"},'||
'{"name": "Password", "type": "password", "pattern": "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$", "required": true, "description": "Minimum eight characters, at least one letter and one number."},'||
'{"name": "Password", "type": "password", "pattern": "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$", "required": true, "description_md": "**Password Requirements:** Minimum **8 characters**, at least **one letter** & **one number**. *Tip:* Use a passphrase for better security!"},'||
'{"label": "I accept the terms and conditions", "name": "terms", "type": "checkbox", "required": true}'||
']')),
('form','Create prepended and appended inputs to make your forms easier to use.',
Expand Down
6 changes: 6 additions & 0 deletions sqlpage/templates/form.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
{{#if description}}
<small class="form-hint mt-0">{{description}}</small>
{{/if}}
{{#if description_md}}
<small class="form-hint mt-0">{{markdown description_md}}</small>
{{/if}}
</div>
</div>
</label>
Expand Down Expand Up @@ -123,6 +126,9 @@
{{#if description}}
<small class="form-hint mt-0">{{description}}</small>
{{/if}}
{{#if description_md}}
<small class="form-hint mt-0">{{markdown description_md}}</small>
{{/if}}
</label>
{{/if}}
{{/if}}
Expand Down
Loading