diff --git a/ckanext/scheming/templates/scheming/form_snippets/radio.html b/ckanext/scheming/templates/scheming/form_snippets/radio.html index 32b6a9e6..7ee6a1cf 100644 --- a/ckanext/scheming/templates/scheming/form_snippets/radio.html +++ b/ckanext/scheming/templates/scheming/form_snippets/radio.html @@ -48,85 +48,30 @@ \ No newline at end of file + toggleFields(); + + document.getElementById('field-type_of_dataset').addEventListener('change', toggleFields); + \ No newline at end of file diff --git a/ckanext/scheming/templates/scheming/form_snippets/select.html b/ckanext/scheming/templates/scheming/form_snippets/select.html index 1098d83a..c056ea87 100644 --- a/ckanext/scheming/templates/scheming/form_snippets/select.html +++ b/ckanext/scheming/templates/scheming/form_snippets/select.html @@ -4,13 +4,15 @@ {%- set form_restrict_choices_to=field.get('form_restrict_choices_to') -%} {%- if not h.scheming_field_required(field) or field.get('form_include_blank_choice', false) -%} - {%- do options.append({'value': '', 'text': ''}) -%} + {# Do not append empty option if not required or include blank choice #} {%- endif -%} {%- for c in h.scheming_field_choices(field) -%} {%- if not form_restrict_choices_to or c.value in form_restrict_choices_to -%} - {%- do options.append({ - 'value': c.value|string, - 'text': h.scheming_language_text(c.label) }) -%} + {%- if c.value != '' -%} + {%- do options.append({ + 'value': c.value|string, + 'text': h.scheming_language_text(c.label) }) -%} + {%- endif -%} {%- endif -%} {%- endfor -%} {%- if field.get('sorted_choices') -%} @@ -35,4 +37,4 @@ ) %} {%- snippet 'scheming/form_snippets/help_text.html', field=field -%} -{% endcall %} +{% endcall %} \ No newline at end of file diff --git a/ckanext/scheming/templates/scheming/form_snippets/text.html b/ckanext/scheming/templates/scheming/form_snippets/text.html index 9d276da0..5ed8e823 100644 --- a/ckanext/scheming/templates/scheming/form_snippets/text.html +++ b/ckanext/scheming/templates/scheming/form_snippets/text.html @@ -14,3 +14,14 @@ %} {%- snippet 'scheming/form_snippets/help_text.html', field=field -%} {% endcall %} + + \ No newline at end of file