Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 5, 2005 05:08:41

Eric E.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Customize formfield class


I am using a custom manipulator:class FooBarManipulator(formfields.Manipulator):    def __init__(self):        self.fields = (            formfields.IntegerField(field_name="foo")            formfields.IntegerField(field_name="bar")            ...        )I would liketo generate the text input fields in the templateusing:{{ form.foo }} {{ form.bar }}This works, but I need to use a different css style for each field. By
default they both would use class=vIntegerField. By adding an optional
argument to the IntegerField and TextField classes that sets the class
variable I was able to set each to the style needed.formfields.IntegerField(field_name="foo", style='input_small") -->class=input_smallIs there a better way to do this, or some reason this is not a good idea?

Offline

#2 Dec. 5, 2005 05:42:28

M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Customize formfield class


Eric Evenson wrote:This works, but I need to use a different css style for each field. Bydefault they both would use class=vIntegerField.They also would have unique ids: "id_foot" and "id_bar". You can stylethem in a style section of your HTML of in separate CSS file referencingby id:<style>
#id_foo {font-size:smaller;}
#id_bar {color:red;}
</style>

Offline

Board footer

Moderator control

Enjoy the 23rd of April
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support