Skip to content

Commit

Permalink
feat: Add optional textarea field to radio boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
petesfrench committed Jan 9, 2025
1 parent acf26d2 commit 126df58
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion templates/partners/silicon/intel/form-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
},
{
"type": "radio",
"label": "other"
"label": "Other (please specify)",
"hasTextarea": true
}
]
},
Expand Down
15 changes: 8 additions & 7 deletions templates/shared/forms/form-fields.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
onsubmit="getCustomFields(event)">
{% for fieldset in fieldsets %}

<!-- fallback values -->
{% if fieldset.id %}
{% set fieldset_id = fieldset.id %}
{% else %}
Expand Down Expand Up @@ -34,7 +33,6 @@
<ul class="p-list">
{% for field in fieldset.fields %}

<!-- fallback values -->
{% if field.id %}
{% set field_id = field.id %}
{% else %}
Expand All @@ -52,12 +50,15 @@
{% elif field.type == "radio" %}
<label class="p-radio">
<input {% if fieldset.isRequired %}required{% endif %}
class="p-radio__input"
type="radio"
aria-labelledby="{{ field_id }}"
name="{{ fieldset_inputName }}"
value="{{ field_value }}" />
class="p-radio__input"
type="radio"
aria-labelledby="{{ field_id }}"
name="{{ fieldset_inputName }}"
value="{{ field_value }}" />
<span class="p-radio__label" id="{{ field_id }}">{{ field.label }}</span>
{% if field.hasTextarea %}
<textarea id="{{ field_id }}-textarea" rows="2" style="margin-top: 0.5rem;"></textarea>
{% endif %}
</label>
{% else %}
<li class="p-list__item">
Expand Down

0 comments on commit 126df58

Please sign in to comment.