Hi Ksenia,
For the empty SelectWidget you might be able to just pass in one option
like:
opts = [ ('None', '', 'None') ]
Not sure if that would work for what you want. I'd be interested to see
some of your form2/javascript forms down the road... something I've been
meaning to investigate.
I've also ran into the issue of ButtonWidget not being in form2/__init__.py
It seems like it should be included to me too. I import this manually
during the declaration of my custom defaultForm(Form) subclass that I use to
customize form nuances globally (like custom css and widget rendering).
I also customized the 'add' function as follows:
def add(self, widget_class, name, *args, **kwargs):
"""
Custom add function to deal with buttons
"""
if self._names.has_key(name):
raise ValueError, "form already has '%s' widget" % name
widget = widget_class(name, *args, **kwargs)
self._names[name] = widget
if isinstance(widget, SubmitWidget):
self.submit_widgets.append(widget) # will be rendered at end
elif isinstance(widget, ButtonWidget):
self.submit_widgets.append(widget) # will be rendered at end
elif isinstance(widget, HiddenWidget):
self.hidden_widgets.append(widget) # will be render at beginning
else:
self.widgets.append(widget)
return widget
(I needed to get the widget back at some point, hence the return) Not sure
if that is something that should be included by default.
Hope that helps...
-Charles.
----- Original Message -----
From: "Ksenia Marasanova"
To:
Sent: Tuesday, November 02, 2004 5:31 PM
Subject: [Quixote-users] some form2 issues
> Hi,
>
> - I want to display an empty SelectWidget, but it seems to be
> impossible. Why not, it can be handy for some user interfaces with
> SelectWidget with size>1 (for example, to transfer options from the
> second list...)
>
> - ButtonWidget is not in __init__.py file in form2 directory, so I
> have to import it like this:
> from quixote.form2.widget import ButtonWidget. Besides that, what is
> the proper way to use ButtonWidget? Now it renders as a button with
> separated description (just like input field)... but I want it to be a
> javascript button.
>
> Thanks!
> --
> Ksenia
> _______________________________________________
> Quixote-users mailing list
> Quixote-users@mems-exchange.org
> http://mail.mems-exchange.org/mailman/listinfo/quixote-users
>