Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8296073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:50:31+00:00 2026-06-08T14:50:31+00:00

I have the ability submit tags in a form. When the form is submitted,

  • 0

I have the ability submit tags in a form. When the form is submitted, I see:

tags=['3','4','5']

The tag values are ID’s for what the user has chosen. I am able to get the values from the request.POST object and everything is fine. Problem is that the user has to select ATLEAST one tag. And I want to do the validation in a Django form, but I’m not sure what kind of form field value to supply in the django form? Normally I use CharField, DateField, etc. But what exists to get the array value? And then I can supply a clean function for it. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:50:35+00:00Added an answer on June 8, 2026 at 2:50 pm

    Try django.forms.MultipleChoiceField().
    See https://docs.djangoproject.com/en/dev/ref/forms/fields/#multiplechoicefield

    known_tags = (
        (1, 'Choice 1'), (2, 'Choice 2'), (3, 'Choice 3'),
        (4, 'Choice 4'), (5, 'Choice 5'))
    
    class MyForm(django.forms.Form):
        tags = django.forms.MultipleChoiceField(choices=known_tags, required=True)
    

    EDIT 1:

    If what you want to do is to turn a text field into an array…

    class MyForm(django.forms.Form):
        tags = django.forms.CharField(required=True)
    
        def clean_tags(self):
            """Split the tags string on whitespace and return a list"""
            return self.cleaned_data['tags'].strip().split()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php site where a user has the ability to login. Once
I see that some C libraries have ability to specify custom memory allocators (
I have setup ability for a user to specify some settings using the in-built
Both Ruby and Python have the ability of calling the debugger from code (
For the site I'm working on, I want a user to have the ability
Im using the following ajax code to submit data from a form to a
We provide the ability to submit images to a user's gallery. While the normal
I have a page with many forms on it. Each form has a unique
In my current application I have allowed the user to submit an image to
I have an asp.net webforms project. In there, an Admin has the ability to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.