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

  • SEARCH
  • Home
  • 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 7193425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:10:04+00:00 2026-05-28T20:10:04+00:00

Is there any options for form field so that any input shall be automatically

  • 0

Is there any options for form field so that any input shall be automatically converted to capital letter and trim from white spaces at the beginning and the end?

If there is not, what is the best practice in enforcing the options above?

  • 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-05-28T20:10:05+00:00Added an answer on May 28, 2026 at 8:10 pm

    You could just override the clean method.

    class MyForm(forms.Form):
        def clean(self):
             return dict([(k, v.strip().upper()) for k, v in self.cleaned_data.items()])
    

    Note that this will run /after/ individual field validation.

    To prevent errors with dates

    def clean(self):
         result = {}
         for k, v in self.cleaned_data.items():
             try:
                 result[k] = v.strip().upper()
             except AttributeError:
                 result[k] = v
         return result     
    

    You could also check if the value is isinstance(value, basestring) and only operate on those.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any debugging options built-in in the Xlib (libX11.so)? Can I get list
A there any g++ options which can detect improper initialization of std::string with NULL
Is there any code or custom options available to achieve the following : 1>
Is there any way to view the contents of the solution user options file
Is there any way to change Visual Studio Auto formatting options? Like VS by
I am wondering if there is any other configuration options for a default controller.
Is there any option to call msi file from CreateProcess in c language in
I have a select form field that I want to mark as readonly, as
I have two objects: Form . A form that I populate from a JSP
I have a form with field names that are generated dynamically by server side

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.