Skip to content

Commit

Permalink
Fixed: strange issue with required textareas (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
signebedi committed Jun 19, 2024
1 parent 44ff6c1 commit e805f5f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions libreforms_fastapi/utils/pydantic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def password_pattern(cls, value):
text_input:
input_type: text
output_type: !str
field_name: text_input
field_label: Text Input
default: Default Text
validators:
min_length: 1
Expand All @@ -197,7 +197,7 @@ def password_pattern(cls, value):
number_input:
input_type: number
output_type: !int
field_name: number_input
field_label: Number Input
default: 42
validators:
ge: 0
Expand All @@ -208,23 +208,23 @@ def password_pattern(cls, value):
email_input:
input_type: email
output_type: !str
field_name: email_input
field_label: Email Input
default: [email protected]
required: false
options: null
description: This is an email field
date_input:
input_type: date
output_type: !date
field_name: date_input
field_label: Date Input
default: 2024-01-01
required: false
options: null
description: This is a date field
checkbox_input:
input_type: checkbox
output_type: !list
field_name: checkbox_input
field_label: Checkbox Input
options:
- Option1
- Option2
Expand All @@ -237,7 +237,7 @@ def password_pattern(cls, value):
radio_input:
input_type: radio
output_type: !str
field_name: radio_input
field_label: Radio Input
options:
- Option1
- Option2
Expand All @@ -247,7 +247,7 @@ def password_pattern(cls, value):
select_input:
input_type: select
output_type: !str
field_name: select_input
field_label: Select Input
options:
- Option1
- Option2
Expand All @@ -258,7 +258,7 @@ def password_pattern(cls, value):
textarea_input:
input_type: textarea
output_type: !str
field_name: textarea_input
field_label: Textarea Input
default: Default textarea content.
validators:
min_length: 0
Expand All @@ -270,7 +270,7 @@ def password_pattern(cls, value):
file_input:
input_type: file
output_type: !bytes
field_name: file_input
field_label: File Input
required: false
default: null
description: This is a file field
Expand Down Expand Up @@ -696,7 +696,7 @@ def get_form_html(
elif field_info['input_type'] == 'textarea':
field_html += f'''
<fieldset class="form-check" style=" padding-top: 20px;">
<label aria-labelledby="{description_id}" for="{field_name}" class="form-check-label">{visible_field_name}{' data-required="true"' if required else ''}</label>
<label aria-labelledby="{description_id}" for="{field_name}" class="form-check-label"{' data-required="true"' if required else ''}>{visible_field_name}</label>
<span id="{description_id}" class="form-text"> {' Required.' if required else ''} {description_text}</span>
<textarea class="form-control" id="{field_name}" name="{field_name}" {field_params} rows="4" style="resize: vertical; max-height: 300px;"{' required' if required else ''}>{default or ''}</textarea>
<div class="valid-feedback"></div>
Expand Down

0 comments on commit e805f5f

Please sign in to comment.