Folks, I've taken note of your comments and work to help me with this. Although I'm afraid that I don't have the skills to participate, I really appreciate your efforts.
Kindest regards, Gary On May 3, 8:59 pm, dlypka <[email protected]> wrote: > FYI > If someone tries to run your code on a fresh empty db, > then they need to first > create a record in the database > and im that case, the record would have id=1 > and so in your code > > def testdata(): > setsubmit() > if request.args: id = request.args[0] > else: id = 3 # Included for testing > > It should be > > def testdata(): > setsubmit() > if request.args: id = request.args[0] > else: id = 1 # default to read the first record > > On May 3, 8:16 pm, dlypka <[email protected]> wrote: > > > The objects in gluon/html.py appear to be what I would call 'controls' > > whereas the objects in gluon\sqlhtml.py are 'widgets'. > > > So I see that Crud uses controls and SQLFORM uses widgets. > > > I am hoping to find a way to use a control in the View markup rather > > than in the Controller. > > I believe that is what Gary needs to do. > > > On May 3, 7:48 pm, Álvaro Justen [Turicas] <[email protected]> > > wrote: > > > > On Sun, May 3, 2009 at 7:32 PM, dlypka <[email protected]> wrote: > > > > > because **inside** the crud() call I believe it (magically) does > > > > this kind of stuff: > > > > > def test(): > > > > f = FORM('Is web2py cool? Why?', > > > > SELECT(OPTION('Yes', _value='y'), OPTION('No', > > > > _value='n'), _name='opts', requires=IS_IN_SET(['y'], > > > > error_message='Errr...wrong answer')), > > > > INPUT(_type='text', _name='why', _value="'cause python > > > > rules", requires=IS_NOT_EMPTY()), > > > > INPUT(_type='submit', _name='btnSubmit', _value='ok')) > > > > if f.accepts(request.vars): > > > > response.flash = 'form accepted' > > > > elif request.vars.btnSubmit: > > > > response.flash = 'error in form' > > > > return dict(myform=f, v=request.vars) > > > > > so in particular crud() generates those INPUT objects for you, and the > > > > INPUT object is the thing which > > > > creates the error attribute inside that INPUT object instance which > > > > then satisfies 'hasattr()' So I believe the solution for you is to > > > > make an INPUT call yourself within the markup, in {{ }} (somehow). > > > > Probably we need to modify the INPUT class Python code > > > > to support that. Basically you need to bind your own instance of an > > > > INPUT class, to the part of your form where you need the <input> tag. > > > > Crud uses SQLFORM to generate forms and SQLTABLE to present data. See > > > gluon/tools.py, class Crud and tools/sqlhtml.py, classes SQLFORM and > > > SQLTABLE. > > > > -- > > > Álvaro Justen > > > Peta5 - Telecomunicações e Software Livre > > > 21 3021-6001 / 9898-0141 > > > http://www.peta5.com.br/-Hidequoted text - > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

