That seems to have done the truck; thanks. I tried to model the code I was replacing as much as possible (I'm just changing the # of rows in a TEXTAREA or adding an OPTION to a SELECT), so there shouldn't be any confusion -- and there doesn't seem to be.
Again, thanks. Scott On May 8, 1:19 pm, mdipierro <[email protected]> wrote: > On a second thought it is not too bad IF all widget have a _name > attribute in the outer html tag. > > On May 8, 12:08 pm, mdipierro <[email protected]> wrote: > > > > > Yes there is a problem! > > > I fixed it for you in trunk (launchpad) but actually it is a bigger > > problem that it seems. With fix is that if the widget is too complex > > it may not display the error (because it is not obvious where the > > error should be displayed). > > I will keep working on this but let me know if this is fine for you > > for now. > > > Massimo > > > On May 8, 11:09 am, Scott Hunter <[email protected]> wrote: > > > > That may have more of a symptom than the cause. The other widget I > > > defined was: > > > > def choice_widget(field,value,labels,required): > > > """ > > > Widget to substitute a pup-up menu with a set of radio buttons > > > """ > > > id=field._tablename+'_'+field.name > > > sro = [] > > > i = 0 > > > selected = False > > > for x in labels: > > > if str(value)==str(i): > > > sro.append( > > > OPTION(x,_value=i,_selected="selected") ) > > > selected = True > > > else: > > > sro.append( OPTION(x,_value=i) ) > > > i += 1 > > > set = [x for x in range(len(labels))] > > > if not selected: > > > sro = [OPTION('', _value=-1)]+sro > > > if not required: > > > set = [-1]+set > > > kw = {'_class':'integer', '_id':id, '_name':field.name, > > > 'requires':IS_IN_SET(set, error_message='required > > > information!')} > > > return SELECT(*sro, **kw) > > > > And here's an example of its use: > > > > db.define_table('tbl', SQLField('field', 'integer', widget=lambda > > > a,b:choice_widget(a,b,['a','b'],True))) > > > > When I bring up an insertion form (through appadmin or my own > > > controller), all is well. But if I try to submit, and there is an > > > error (as there will be if nothing is changed), the nesting originally > > > described appears on the page w/ the error message (for a SELECT, > > > you'd have to view the source to see the nesting). If I reload the > > > form, the nesting appears (but the error messages do not). If I > > > navigate away from and back to the insertion form, there's no nesting > > > (and no error message). > > > > Thanks again, > > > Scott > > > > On May 8, 10:46 am, mdipierro <[email protected]> wrote: > > > > > I cannot reproduce the problem but there is a typo in your code > > > > > "Widget to allow size of textarea to be specified"" > > > > > should be > > > > > "Widget to allow size of textarea to be specified" > > > > > Massimo > > > > > On May 8, 9:12 am, Scott Hunter <[email protected]> wrote: > > > > > > Just downloaded v 1.61.4 (Mac), and I'm having a problem w/ widgets. > > > > > For example: > > > > > > def ta_widget(field,value,nr): > > > > > "Widget to allow size of textarea to be specified"" > > > > > return TEXTAREA("xyz", _type="text", _class="text", _rows=nr, > > > > > _cols=40, > > > > > _name=field.name, > > > > > _id=field._tablename+'_'+field.name) > > > > > > ... > > > > > SQLField('textfield','text',widget=lambda a,b:ta_widget(a,b,1)), > > > > > ... > > > > > > Yields the following HTML, which presents as a text area w/ a copy of > > > > > the tag included in the content: > > > > > > <textarea class="text" cols="40" id="worksheets_heatdist_defects" > > > > > name="heatdist_defects" rows="1" type="text"><textarea class="text" > > > > > cols="40" id="worksheets_heatdist_defects" name="heatdist_defects" > > > > > rows="1" type="text">xyz</textarea></textarea> > > > > > > I have a similar problem w/ a widget that yields a SELECT producing > > > > > one SELECT inside another (which the browser can handle). > > > > > > I'd used the ta_widget in earlier versions of web2py (01/09?). > > > > > > Thanks for the help, > > > > > Scott --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

