[Grok-dev] @grok.action doesn't play well with jQuery
Kevin Smith
kevin at mcweekly.com
Tue Mar 18 12:25:48 EDT 2008
You can use a selector like this
$('input[@name=form.actions.save]') which produces a list of results
or
$('input[@name=form.actions.save]')[0] assuming it's the first save form
or even
$('input[@id=form.actions.save]')[0] //untested
Sebastian Ware wrote:
> While implementing a javascript table editor with jQuery I came across
> the following problem.
>
> @grok.action('Save')
>
> renders html like this (using the action.render() method)
>
> <input type="submit" id="form.actions.save" name="form.actions.save"
> value="Save" class="button" />
>
> but I can't bind jQuery events to an [id] with dots as in
> [id="form.actions.save"] (it won't find the element). It works if I
> exchange the dots with for example underscores
> [id="form_actions_save"] giving the following html
>
> <input type="submit" id="form_actions_save" name="form.actions.save"
> value="Save" class="button" />
>
> I am not sure why this doesn't play well with jQuery, it might be
> their concept of event namespaces that also affects how they handle id.
>
> Anyway, I really like jQuery because it has a very "grokkish" approach
> to javascript (write less, do more...) so I think it would be a great
> idea to change the way grok.action generates ids.
>
> Mvh Sebastian
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
>
>
More information about the Grok-dev
mailing list