HTML DOM Events

16 views
Skip to first unread message

Sungsam Gong

unread,
Aug 8, 2012, 5:29:28 AM8/8/12
to formh...@googlegroups.com
Hi all,

There might be a proper document, but still hanging'n there - so
better to giving a shout.

How can I insert a HTML DOM Event?
For example:
<input type="submit" name="submit" id="submit" value="Go"
onClick="$('#my_activity').activity()>
or
<form id="form114" method="post" onSubmit="$('#my_activity').activity()">

Regards,
Sung

Patrick Meidl

unread,
Aug 8, 2012, 7:34:50 AM8/8/12
to formh...@googlegroups.com
On Wed, Aug 08 2012, Sungsam Gong <gong.s...@gmail.com> wrote:

> How can I insert a HTML DOM Event?
> For example:
> <input type="submit" name="submit" id="submit" value="Go"
> onClick="$('#my_activity').activity()>
> or
> <form id="form114" method="post" onSubmit="$('#my_activity').activity()">

you could use 'element_attrib':

has_field 'submit' => (
type => 'Submit',
element_attr => {
onClick => "$('#my_activity').activity()",
},
);

> There might be a proper document, but still hanging'n there - so
> better to giving a shout.

once you are familiar with the basics, the Reference manual is one of
the most useful pieces of documentation IMHO:

https://metacpan.org/module/HTML::FormHandler::Manual::Reference

HTH

patrick

--
Patrick Meidl ........................ pat...@pantheon.at
Vienna, Austria ...................... http://gplus.to/pmeidl

Sungsam Gong

unread,
Aug 8, 2012, 7:52:10 AM8/8/12
to formh...@googlegroups.com
Thanks Patrick.

I actually have seen 'element_attr' and tried before posting this, but
with no success - still printing <input type="submit" name="submit"
id="submit" value="Go" /> only.
Does the use of 'HTML::FormHandler::Widget::Form::Table' within the form matter?
Mine is built on HFH 0.36003.

Regards,
Sung
> --
> You received this message because you are subscribed to the Google Groups "formhandler" group.
> To post to this group, send email to formh...@googlegroups.com.
> To unsubscribe from this group, send email to formhandler...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/formhandler?hl=en.
>

Patrick Meidl

unread,
Aug 8, 2012, 8:05:39 AM8/8/12
to formh...@googlegroups.com
On Wed, Aug 08 2012, Sungsam Gong <gong.s...@gmail.com> wrote:

> I actually have seen 'element_attr' and tried before posting this, but
> with no success - still printing <input type="submit" name="submit"
> id="submit" value="Go" /> only.
> Does the use of 'HTML::FormHandler::Widget::Form::Table' within the
> form matter?

no, this is just a wrapper around your field, so doesn't affect the
rendering of the field itself.

> Mine is built on HFH 0.36003.

looks like in this version, the attribute was called 'html_attr'
instead.

BTW, to get the correct documentation for the version you are using, you
should select your version in the left column of the metacpan.org
display (or navigate to the version on cpan.org).

Steve

unread,
Aug 8, 2012, 8:19:42 AM8/8/12
to formh...@googlegroups.com
FWIW - If you are new to HFH, it's probably best to start with the
newest version, assuming you have some say in this... 'html_attr' use
is deprecated and will require changes to your existing code if you
update the module at some point in the future.

Steve

Sung Gong

unread,
Aug 8, 2012, 8:33:45 AM8/8/12
to formh...@googlegroups.com
Thanks Steve and Patrick.

Patrick Meidl

unread,
Aug 8, 2012, 8:36:55 AM8/8/12
to formh...@googlegroups.com
On Wed, Aug 08 2012, Steve <st...@matsch.com> wrote:

> FWIW - If you are new to HFH, it's probably best to start with the
> newest version, assuming you have some say in this... 'html_attr' use
> is deprecated and will require changes to your existing code if you
> update the module at some point in the future.

you are right of course. but since the OP said he uses a certain old
version, I was assuming he is working on an existing project which
depends on this version.

this assumption might be wrong, though, because lots of users install
perl modules from OS distribution packages which are often out-of-date
(especially if you use e.g. Debian stable). I therefore always install
perl modules directly from cpan.

cheers
Reply all
Reply to author
Forward
0 new messages