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 8768757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:08:53+00:00 2026-06-13T17:08:53+00:00

I am trying to use forms module https://github.com/caolan/forms . I could easily get the

  • 0

I am trying to use forms module https://github.com/caolan/forms . I could easily get the forms created without any issues. But I am just wondering how do you add a new class name to the existing field. The documentation talks about the overriding the id. But I could not find a way to add a new class to the tag.

tried the following..but it wont work!

  username: fields.string({
    required: true,
    label: 'So What',
    classes: ['classtest']
    }),

There is a attribute called widget (which in turn has attribute ‘classes’) for field. But could not get it working either. This is what I tried. Which also failed.

username: fields.string({
required: true,
label: 'So What',
widget: {
  classes: 'testclass'
}
}),

Any help in this regard would help. Ultimately i am trying to style the forms with bootstrap

  • 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-13T17:08:54+00:00Added an answer on June 13, 2026 at 5:08 pm

    It looks like the module doesn’t allow classes anywhere except at the widget level. Use the following to apply classes to the input box (ie. widget).

    username: fields.string({
        required: true,
        label: 'So What',
        widget: forms.widgets.text({
            classes: ['testclass']
        })
    })
    

    The current form module API provides no way to extend the classes that are placed on the surrounding div element. Here is a bit of stack trace as to how I found it out:

    1. lib/fields.js#L68 calls forms.render.div
    2. forms.render.div calls field.classes().join(‘ ‘)
    3. field.classes() returns a rigid array of classes. The only options are field, error, and required.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use this module on opencms: http://www.codedroids.com/en/opencms/downloads/com.codedroids.oc.forms.html I am following the documentation:
I'm trying to use forms with modules, they should be stored inside the module.
I am using webapp2, ndb model. I was trying to use django model forms
While trying to use LINQ in a .NET 2.0 Windows Forms project I got:
I'm trying to use HTML5 Constraint Validation in my forms to help users spot
I'm trying to figure out how to use jQuery AJAX with Python's Bottle module.
So I'm trying to use the CGI module that comes with Python, on a
Trying to use the Formo module with ORM and Kohana 3.1, but keep getting
I'm trying to use the Tenjin module but it fails because it can't find
I am trying to use the JavaScript Module Pattern and I run into a

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.