Hi there,

I am not sure if I am doing anything wrong with my controller code.
Here's the behavior -

User tries to submit a form and has to enter atleast 3 fields (Name,
Notebook, Page). Other fields like Project, Source and Resistance are
pre-selected from database. When the user tries to submit without the
required fields, the web2py form validation shows up ("cannot be
empty") which is good. But the strange thing that happens, is that all
the Resistance checkbox fields get selected while the other fields
(Project, Source) remain intact.

Any ideas/suggestions will be appreciated. TIA!

<!--- controller -->
      r = ''
      record = db(query).select(db.Entries.ALL)

      for a in record:
        # resist.table contains ['None', 'Amp', 'Kan', 'Str', 'Cam']
        r = a.resist_genom.split('+')  # contains array ['Amp','Kan']

        form=FORM(TABLE(
            TR(TD("Name:",_class="right"),INPUT(_type="text",
_size="", _name="name", value=str(a.name)+".1", requires=[IS_NOT_EMPTY
()] ),
            TD("Notebook:",_class="right"),INPUT
(_type="text",_name="notebook",_size="8", requires=IS_NOT_EMPTY()),
            TD("Page:",_class="right"),INPUT
(_type="text",_size="5",_name="page", requires=IS_NOT_EMPTY()),
            TD("Project:",_class="right"),SELECT
(_size="1",_name="project",_type="select", value=a.project,*[OPTION
(x.name,_value=x.id) for x in db().select
(db.project.ALL)]),
            TD("Source:",_class="right"),SELECT
(_size="1",_name="source",_type="select", value=a.source,*[OPTION
(x.name,_value=x.id) for x in db().select(db.source.ALL)]),
            )),
             BR(),
            TR(TD("Resistance:", *[TD(x.name, INPUT(_type="checkbox",
_name="resist_genom",_value=x.name, value=x.name in r)) for x in db
().select(db.resist.ALL)]),
               ),
            ----- code shortened-----
<!-- end controller -->
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to