The validation plugin binds various events to the form, handling everything
that bubbles up from its form elements. So you don't have to add any event
binding after adding new elements, just make sure the validation rules are
present. If it isn't working, its probably a different issue.

Jörn

On Mon, Jan 5, 2009 at 11:26 PM, Rob <robstefanus...@gmail.com> wrote:

>
> Thanks Brian,
>
> At the moment I'm using basically the simplest implementation of the
> plugin.  I'm using inline rules, so I don't have to worry about the
> brackets yet.  I do understand the event delegation, I had thought
> that calling $("#form").validate() again after inserting the elements
> would do the trick, but no such luck.
>
> Rob
>
> On Jan 5, 1:12 pm, brian <bally.z...@gmail.com> wrote:
> > On Mon, Jan 5, 2009 at 2:40 PM, Rob <robstefanus...@gmail.com> wrote:
> >
> > > Hi Jörn or anyone else familiar with this plugin,
> >
> > > First off, thanks for the great validation plugin.  I hope I do not
> > > impose too much with this question.
> >
> > > I have a dynamic form with fields named using brackets ([]).
> >
> > See this note:
> http://docs.jquery.com/Plugins/Validation/Reference#Fields_with_compl...
> >
> > > Validation is working for fields that existed on the initial page
> > > load, but when I add append the code for a new field, the validation
> > > events are, of course, not attached to the new DOM elements.  What's
> > > the best way to accomplish this?
> >
> > Make sure you understand event delegation. There's some info in the
> > docs. Basically, you need to ensure that any newly-created elements
> > are bound to event handlers. You can either bind them when they are
> > added or bind the container and findthe specific element in your event
> > handler by getting event.target.
> >
> > Though, I've no idea how to do this with the Validation plugin,
> specifically.
>

Reply via email to