On Fri, May 7, 2010 at 3:42 PM, Miguel Lopes <[email protected]> wrote:
> > > On Fri, May 7, 2010 at 3:29 PM, mdipierro <[email protected]> wrote: > >> Errors in form.errors (which is a Storage object and extends a dict). >> Perhaps they can be displayed somewhere else? >> >> > Yes of course. But the point is that if the extension mechanism for widgets > could perhaps be polished so that it is not limited to the set of elements > that the framework expects. Given the benefit of encapsulating code in the > widget I believe this is worthwhile. > > Also, this means that once a widget that breaks this functionality is > included then if we want to preserve look and feel across the app we must > change all form error displaying functionality everywhere! > It also breaks the validation system (except if the validator is declared in the requires argument of the inner widget). > > Miguel > > > > >> On May 7, 7:26 am, Miguel Lopes <[email protected]> wrote: >> > Encapsulating javascript code within some widgets is a good solution >> when >> > the functionality is generic. This widgets act like drop-in components. >> > >> > Two examples by mr.freeze are (txs for the nice concept mr.freeze): >> http://www.web2pyslices.com/main/slices/take_slice/24http://www.web2pyslices.com/main/slices/take_slice/66 >> > >> > However, the solution proposed by mr.freeze breaks the form mechanism >> for >> > displaying errors, since it encapsulates the script and input elements >> in a >> > div element. The problem is that form validation is expecting some an >> input >> > type widget (input, select, checkbox, ...) and not a div element. The >> > consequence is that although the field is validated, errors are not >> > displayed. >> > >> > I'm not familiar enough with web2py's code base. Perhaps someone as a >> > solution for this. If there is no solution, I suppose some solution >> could be >> > devised that allows for encapsulating scripting within the widget. >> Perhaps >> > inheriting from the standard div tag and creating an extended div that >> knows >> > how to deal with errors? >> > >> > Miguel >> > >

