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

No organization available: form error without any relevant field #471

Open
frafra opened this issue Oct 21, 2021 · 0 comments
Open

No organization available: form error without any relevant field #471

frafra opened this issue Oct 21, 2021 · 0 comments

Comments

@frafra
Copy link
Contributor

frafra commented Oct 21, 2021

When there are no organizations defined and a harvest source is created, the forms gives an error, because no organization has been selected. I think this message is confusing, as there is no field for selecting such organization.

I would suggest showing a message if no organization is defined before submitting the form.

{% set show_organizations_selector = organizations_available and (user_is_sysadmin or dataset_is_draft) %}
{% if show_organizations_selector %}
{% set existing_org = data.owner_org %}
<div class="control-group form-group">
<label for="field-organizations" class="control-label">{{ _('Organization') }}</label>
<div class="controls">
<select id="field-organizations" name="owner_org" data-module="autocomplete">
<option value="" {% if not selected_org and data.id %} selected="selected" {% endif %}>{{ _('No organization') }}</option>
{% for organization in organizations_available %}
{# get out first org from users list only if there is not an existing org #}
{% set selected_org = (existing_org and existing_org == organization.id) or (not existing_org and not data.id and organization.id == organizations_available[0].id) %}
<option value="{{ organization.id }}" {% if selected_org %} selected="selected" {% endif %}>{{ organization.name }}</option>
{% endfor %}
</select>
</div>
</div>
{% endif %}

Instead of having only an if, an else could be created, with a link to define an organization, or some kind of help text. An empty readonly selector could also be shown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant