Hi Jim,

Yes, you can add any arbitrary html attribute to form inputs with
webpy's form library. You can, for instance, do this:

from web import form

f = form.Form(
    form.Textbox('myinput',
        description='My Input',
        onclick='onClickHandler'
    )
)

Will generate an input like:

<input name="myinput" type="text" onclick="onClickHandler"/>

Technically, nearly all keyword args become html attributes
(description is a notable exception). For example:

f = form.Form(
    form.Textbox('foo',
        bar='baz'
    )
)

would render into:

<input type="text" name="foo" bar="baz"/>

Hope this helps!

Cheers,
Justin

On Oct 20, 4:30 am, Jim Gregory <[email protected]> wrote:
> Is it possible to include javascript event-handling functions like
> 'onchange' or 'onclick' to web.py form elements?  I realize that the
> usual practice is to have a separate script that handles form
> handling, but sometimes I find it convenient to make a simple
> modification to an element without having to include a script.
> Thanks.
>
> -Jim

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to