I've uploaded the latest validator stuff to http://barcamp.supa.ws .. you
can see it in action if you:

 1. login with 'admin' 'admin'
 2. hit 'Users'
 3. hit 'New'
 4. try to call your new user 'admin' and hit ok

What's happening is:
 1. reacting to OK button being hit here:
https://github.com/matiu2/witty-plus/blob/master/base-app/UserEdit.cpp#L92
 2. This calls 'validateAll':
https://github.com/matiu2/witty-plus/blob/master/base-app/lib/MoreAwesomeTemplate.hpp#L167
 3. Validate all users a static method of ServerSideValidator on line 175,
which will try to push the message down to the browser.
 4. This validate method (ServerSideValidationResult) handles lots of
different validator and widget types (hopefully all of them) pretty
generically,
     but it really likes it's own descendants that support
"validateWithMessage":
https://github.com/matiu2/witty-plus/blob/master/base-app/lib/ServerSideValidator.hpp#L63
 5. the DBNoDupValidator (for edtName) does a DB loookup and returns a nice
message (server side):
https://github.com/matiu2/witty-plus/blob/master/base-app/lib/DBNoDupValidator.hpp#L72
 6. The ServerSideValidator then sends attaches this validation result to
the widget (in javascript) on the client:
https://github.com/matiu2/witty-plus/blob/master/base-app/lib/ServerSideValidator.hpp#L102
 7. The custom javascript validate function understands that:
https://github.com/matiu2/witty-plus/blob/master/base-app/lib/js/customValidate.js#L25
 8. The base application has over-ridden the original witty 'validate' js
func with our new funkier one here:
https://github.com/matiu2/witty-plus/blob/master/base-app/lib/BaseApp.hpp#L53

On a side note, it hooks up a WText to show the validation result, and the
custom JS function puts the message in there as well as in the 'title'
attribute like the standard Wt.

I know it was a really really long way to get what I wanted, but I'm happy.
I learned a lot, I got the result I'm after (seemlessish generic validation
results), and I'm happy to share a little on doing custom JS in witty.

Thanks and well done if you managed to read down this far.

Kind Regards,
Matthew Sherborne


On Mon, Oct 3, 2011 at 3:33 PM, Alec Taylor <alec.tayl...@gmail.com> wrote:

> Thanks for sharing the project.
>
> Parvinder: http://matiu2.github.com/witty-plus/
>
> On Mon, Oct 3, 2011 at 3:41 PM, PARVINDER RAJPUT <m...@parvinder.co.in>
> wrote:
> > Nice
> > Can we see its source code
> > --
> > Parvinder Rajput
> > website:- www.parvinder.co.in
> >
> >
> ------------------------------------------------------------------------------
> > All the data continuously generated in your IT infrastructure contains a
> > definitive record of customers, application performance, security
> > threats, fraudulent activity and more. Splunk takes this data and makes
> > sense of it. Business sense. IT sense. Common sense.
> > http://p.sf.net/sfu/splunk-d2dcopy1
> > _______________________________________________
> > witty-interest mailing list
> > witty-interest@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/witty-interest
> >
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to