[Catalyst] HTML::FormHandler IDs not playing with JQuery
Jason Galea
lists at eightdegrees.com.au
Sat Apr 2 13:05:31 GMT 2011
On Tue, Mar 29, 2011 at 8:43 PM, Victor Churchill
<victorchurchill at gmail.com> wrote:
> Trouble is I would like to use id="q1_select.0" as a JQuery selector
> to control the show/hide of 'child' questions, and the selector does
> not like the ".0". I determined with a couple of manual tests that I
> can't select an item with a period in the ID - or so it appears
> anyway.
I had the same issue, not sure if it was for the same reasons.. but
now have this in my code.. (use '-' instead of '.' in form id's)
my forms have a base class which contains:
has '+field_traits' => ( default => sub { ['My::Form::Role'] } );
and then..
package My::Form::Role;
use Moose::Role;
around 'build_id' => sub {
my $orig = shift;
my $self = shift;
my $prefix = ( $self->form && $self->form->html_prefix ) ?
$self->form->name . "-" : '';
return $prefix . $self->full_name;
};
no Moose::Role;
1;
cheers,
J
More information about the Catalyst
mailing list