{% comment %} Form Field Component Usage: {% include 'dashboard/components/form_field.html' with type="text" name="username" label="Username" value=user.username placeholder="Enter username" required=True help_text="Your unique username" error=form.username.errors %} Parameters: - type: Field type (text, email, password, number, textarea, select, checkbox, radio, file) - default: text - name: Field name (required) - id: Field id (defaults to name if not provided) - label: Field label (required) - value: Field value (optional) - placeholder: Field placeholder (optional) - required: Whether the field is required (default: False) - disabled: Whether the field is disabled (default: False) - readonly: Whether the field is readonly (default: False) - help_text: Help text to display below the field (optional) - error: Error message to display (optional) - options: List of options for select, checkbox, radio fields (required for these types) - rows: Number of rows for textarea (default: 3) - min, max, step: For number inputs (optional) {% endcomment %} {% if not name %} {% comment %}Ensure name is provided{% endcomment %}
Error: 'name' parameter is required for form_field component
{% else %}
{% if type != 'checkbox' and type != 'radio' %} {% endif %} {% if type == 'textarea' %} {% elif type == 'select' %} {% elif type == 'checkbox' %}
{% if help_text %}

{{ help_text }}

{% endif %}
{% elif type == 'radio' %}
{{ label }}
{% for option in options %}
{% endfor %}
{% elif type == 'file' %}

or drag and drop

{{ help_text|default:'PNG, JPG, GIF up to 10MB' }}

{% else %} {% endif %} {% if help_text and type != 'checkbox' and type != 'file' %}

{{ help_text }}

{% endif %} {% if error %}

{{ error }}

{% endif %}
{% endif %}