> what you describe here is (at least by me) preceived as 'application
> controller' logic and not as 'validation'

I still see it as validation, instead of validating against static values
you are validating against a set of values in a database. Though anything
more advanced like account locking would be biz-logic.

Looking through the woody API I came up with the following:

- get the value from a widget:
aForm.getWidget(aId).getValue();

- if it's not valid set a validation error
protected void setValidationError(Form aForm, String aId, String
aErrorMessage) throws Exception{
                Widget widget=aForm.getWidget(aId);
                if (widget!=null && widget instanceof Field)
                        ((Field)widget).setValidationError(new
ValidationError(aErrorMessage,false));
                else{
                        if (widget==null)
                                throw new Exception("Field with id "+aId+" does not 
exist");
                        else
                                throw new Exception("Only field widgets can be 
validated in the form
handler");
                }
        }

Mark



> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> ]On Behalf Of Marc Portier
> Sent: 20 October 2003 21:28
> To: [EMAIL PROTECTED]
> Subject: Re: Woody validation
>
>
>
>
> Mark H wrote:
>
> > How would I validate a woody form against a database? For example seeing
> > whether a username and password was valid?
> >
>
> Mark,
>
> what you describe here is (at least by me) preceived as 'application
> controller' logic and not as 'validation'
>
> validation is the process of checking general properties of the data
> entered in the form (has it more then 8 chars, is it according to a
> known pattern?, is one data-entry bigger then another,... see the samples)
>
> application control however is the kind of code that accesses backends,
> executes business logic and decides what to do next (e.g. close the
> account after 3 wrong login attempts)
>
> note that above distinction is more a guide then a limitation in any
> way, following the guide you will however encounter more people that can
> easily understand what you are doing and offer advice.
>
>
> still I need to get you somewhere:
> have a look at one of the flowscipts in the woody samples, they offer
> samples of how to control the forms, read the data that was entered
> (after validation was succesful) and then do stuff with it
>
> I don't think there is already some woody-sample that does some JDBC
> stuff, but there must be samples in the flowscript area on how to
> connect to databases IIRC, a smart combination of the two sets of
> samples should get you going
>
> HTH,
> -marc=
>
>
>
> > Thanks,
> > Mark
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> --
> Marc Portier                            http://outerthought.org/
> Outerthought - Open Source, Java & XML Competence Support Center
> Read my weblog at              http://radio.weblogs.com/0116284/
> [EMAIL PROTECTED]                              [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to