Skip to content

Improve Sample Project Fields Validation Display #341

Description

@saramonzon

Description of feature

Description

Currently, when defining or modifying Sample Project Fields, a JavaScript alert popup appears if no field is marked as "Used." This check ensures that at least one field is selected before submitting the form. However, displaying this validation via a popup is not user-friendly and should be replaced with an error message displayed inline within the page.

Steps to Reproduce

  1. Navigate to the Sample Project Fields section.
  2. Define or modify fields and ensure none are marked as "Used."
  3. Attempt to submit the form.
  4. Observe that a JavaScript alert popup appears warning the user.

Expected Behavior

  • The validation message should be displayed inline, near the relevant input fields.
  • Users should not receive an intrusive alert popup.
  • The form should not submit until at least one field is set to "Used."

Actual Behavior

  • A JavaScript alert() popup appears to notify users about the missing required selection.

Suggested Fix

  • Replace the JavaScript alert() popup with an inline error message in the form.
  • Example implementation:
    <div class="error-message">At least one field must be marked as "Used." Please update your selection.</div>
  • If using JavaScript, update the DOM instead of triggering an alert.
  • Use Django messages framework or form validation mechanisms to enforce this check at the backend as well.

Environment

  • Django Version: [Add version]
  • Python Version: [Add version]
  • Affected Page: Sample Project Fields

Additional Context

This update will enhance the user experience and ensure validation messages are more accessible and intuitive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions