You can change how a field (validator) displays itself by setting the
widget kwarg for the field object.  Widget is a base argument for a
field, so all fields accept it.  That would be how to implement the
CharField as a select and any other field as a hidden element (hidden
isn't really a type of data, just a way of displaying/transferring it,
so it is a widget).  Check out the svn code for the latest on what the
widgets look like (one level higher in the tree is fields.py, which has
the fields).

http://code.djangoproject.com/browser/django/trunk/django/newforms/widgets.py

As for the FloatField, I think the only way to implement that right now
in newforms would be with a regex validator (RegexField).  Can anyone
else confirm?  Would you find a FloatField useful?  It wouldn't be too
hard to set up a predefined RegexField that validates floating numbers
to a certain precision, but this may be a bit overkill if the goal is
to keep the code lean and flexible since you can do the same yourself
with a regex field.  What do others think?

On Jan 24, 6:11 am, "ak" <[EMAIL PROTECTED]> wrote:
> Hello everyone
>
> I don't see FloatField and HiddenField field types in newforms. Is it
> ok ?
> How to implement <input type="hidden" .../> then ?
>
> And also: oldforms has a nice feature to convert
> CharField(choices=(...)) to dropdown (<input type="select" ...>) with
> predefined options, newforms displays it as <input type="text" ...>, I
> think this is not ok. Isn't it ?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to