is it possible to display just one error message of a list:string input 
right after the last input control, using SQLFORM.grid?

With SQLFORM,grid create/update form, when a list:string field with 
validators has errors it should be possible to hide the error display on 
all list inputs but the last one. At least that's how I interpret the 
current ListWidget code in sqlform.py
        nvalue = value or ['']
        items = [LI(INPUT(_id=_id, _class=_class, _name=_name,
                          value=v, hideerror=k < len(nvalue) - 1,
                          requires=requires),
                    **attributes) for (k, v) in enumerate(nvalue)]
so hideerror=True for all input items but the last one. Effectively, this 
should display a single error message after the last string of the list. 
How nice, but it doesn't seem to work, and the form repeats the same error 
message under each string of the list - 100 times if the list:string 
comprises 100 elements.
I'm not sure where the hideerror attribute gets reset in the chain. I check 
its value in function _translate, and it's always false, even when I add 
this code after the above code in the ListWidget - for the sake of 
investigating this issue.
        for i in items:
            for e in i.elements:
                e.attributes['hideerror'] = True
hideerror is still == False for all self.components in _translate() while 
I'd expect it to be True for components that correspond to my list:string 
inputs.
    def _traverse(self, status, hideerror=False):
# zip zip...

        # for input, textarea, select, option
        # deal with 'value' and 'validation'

        name = self['_name']
        print name, self['hideerror'] # this always prints False


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to