[jifty-devel] Patch to add AJAX validation warnings

Sean E. Millichamp sean at enertronllc.com
Mon May 8 06:51:34 EDT 2006

On Mon, 2006-05-08 at 00:09 -0400, Jesse Vincent wrote:

> On Sun, May 07, 2006 at 10:54:01AM -0400, Sean E. Millichamp wrote:
> > I was playing around with AJAX validations in one of my Action:: modules
> > the other day and decided that Jifty::Action's should have a
> > validation_warning() function that does an AJAX-enabled message display
> > within a form but does not prevent the overall Action from succeeding.
> The use case sounds sane. The only reason I haven't applied this yet is
> because it's starting to feel like we're copying and pasting the same
> basic code a bit much and we might be missing an abstraction here.
> Sean, does my concern make sense?  Or does it feel different enough?

After making it work I too had the same concern.  But when I went back
and looked at it again I wasn't sure that there was much to be gained.
I looked at reducing the number of methods and I suppose you could do
something like changing error/warning_div_id to a generic
"message_div_id" and add a parameter to specify the type, except they
are such simple functions I just didn't see a lot to be gained unless a
third, similar, message type was needed.

Also, I considered passing in both IDs in one tag in validator.xml and
having the Javascript in jifty.js do the right thing, but it wasn't
clear to me that was any more desirable then just doing two tags.  And,
personally, I'd rather keep the Javascript simpler and do as much as I
can in Perl :).

If someone does have a clear idea on how to abstract this out better
please do suggest it, you won't be hurting my feelings - I was just
thrilled to find all the right pieces in Jifty to get it working for the
original patch :)


 Sean E. Millichamp, Enertron LLC, 586-757-1200 x102

More information about the jifty-devel mailing list