I just fall on this trying to understand web2py list:string code :
Also notice that this field gets a default represent attribute which represents the list of references as a comma-separated list of formatted references. This is used in read forms and SQLTABLEs. While list:reference has a default validator and a default representation, list:integer and list:string do not. So these two need an IS_IN_SETor an IS_IN_DB validator if you want to use them in forms. It may be the reason of your issue, may try to use IS_IN_SET() maybe?? Richard On Wed, Aug 12, 2015 at 8:53 PM, Richard Vézina <ml.richard.vez...@gmail.com > wrote: > They show in flash in 2.9.11 and 2.9.12... > > Though the widget doesn't displayed them... > > Do you see values in the flash message or not? From my understanding of > you last message you have them... > > So, if it the case, I am pretty sure it is a widget issue... This issue > seems to be there for a wild, I guess not much user have use this widget > with keepvalue=True and it pass silently... > > You can open a ticket and link this thread. > > You may link you dummy app a way to reproduce the issue. > > Richard > > On Wed, Aug 12, 2015 at 8:45 PM, Richard Vézina < > ml.richard.vez...@gmail.com> wrote: > >> If I bring your stuff into a dummy web2py app under web2py 2.9.5, the >> keeped values appears in the flash message... Though they are not appearing >> in the widget... >> >> I will try it under more recent version... >> >> wait >> >> On Wed, Aug 12, 2015 at 8:24 PM, Ian W. Scott <scotti...@gmail.com> >> wrote: >> >>> Hi Richard, >>> >>> Here's the packed app (list_string_test). I put a simple SQLFORM on the >>> default/index to demonstrate the problem. The first field is a simple >>> string field that keeps its values. The second field is a list:string field >>> that doesn't. Actually, the list:string widget doesn't get populated with >>> *any* of the submitted values. (I said before that the first one was kept, >>> but it isn't). The response.flash message also shows you the submitted >>> values for the list:string field, so you can see that on resubmission the >>> blank field really doesn't submit any values. >>> >>> Assuming that you see the same problem here, do you want me to create >>> the github issue or will you? >>> >>> Ian >>> >>> On Wednesday, August 12, 2015 at 2:04:28 PM UTC-4, Richard wrote: >>>> >>>> Hi Ian, >>>> >>>> Can you pack a dummy app with a list:string field an single field form >>>> with SQLFORM.factory so I can try it here and confirm your issue... >>>> >>>> Also, can you tell us which web2py version you use. >>>> >>>> Thanks >>>> >>>> Richard >>>> >>>> PS.: Once I confirm I have the issue we should open a ticket on >>>> github... >>>> >>>> # >>>> >>>> On Wed, Aug 12, 2015 at 1:41 PM, Ian W. Scott <scot...@gmail.com> >>>> wrote: >>>> >>>>> No, they're not submitted if I re-submit the form with the preserved >>>>> values. >>>>> >>>>> Ian >>>>> >>>>> On Wednesday, August 12, 2015 at 1:25:01 PM UTC-4, Richard wrote: >>>>>> >>>>>> Is the form widget only display the last input but insert the other >>>>>> values? I mean, it may be possible that values are there but not >>>>>> correctly >>>>>> display by the widget... >>>>>> >>>>>> Richard >>>>>> >>>>>> On Wed, Aug 12, 2015 at 1:21 PM, Ian W. Scott <scot...@gmail.com> >>>>>> wrote: >>>>>> >>>>>>> Sorry if I'm not explaining this well. The default widget for a >>>>>>> list:string field is a vertically stacked list of inputs, one per value. >>>>>>> There is a little + at right that allows me to add more inputs to the >>>>>>> list >>>>>>> dynamically. >>>>>>> >>>>>>> In a SQLFORM, when I set keepvalues=True the values are preserved in >>>>>>> the form fields after form submission. But only one of the inputs from >>>>>>> the >>>>>>> list:string widget is left, holding just the last string value submitted >>>>>>> for that field. In other words, the form doesn't remember the additional >>>>>>> inputs I added to the widget (by clicking +) before submission, and it >>>>>>> forgets the submitted values from those additional inputs as well. >>>>>>> >>>>>>> I've experienced this on many forms, so I don't think it's my code. >>>>>>> In the case that brought this up for me again, I'm creating a >>>>>>> SQLFORM.factory with the fields defined in the controller. (You can see >>>>>>> that I've got some for loops to simplify the creation and processing of >>>>>>> a >>>>>>> large number of fields, but otherwise it's straightforward.) The problem >>>>>>> appears with the widgets for any of the list:string fields: >>>>>>> >>>>>>> >>>>>>> message = '' >>>>>>> output = '' >>>>>>> >>>>>>> flds = [Field('label_template', 'string'), >>>>>>> Field('words', 'list:string'), >>>>>>> Field('aligned', 'boolean'), >>>>>>> Field('avoid', 'list:string'), >>>>>>> Field('testing', 'boolean')] >>>>>>> >>>>>>> >>>>>>> for n in ['one', 'two', 'three', 'four', 'five']: >>>>>>> fbs = [Field('{}_prompt_template'.format(n), >>>>>>> 'list:string'), >>>>>>> Field('{}_response_template'.format(n), >>>>>>> 'list:string'), >>>>>>> Field('{}_readable_template'.format(n), >>>>>>> 'list:string'), >>>>>>> Field('{}_tags'.format(n), 'list:reference tags', >>>>>>> requires=IS_IN_DB(db, 'tags.id', '%(tag)s', >>>>>>> multiple=True)), >>>>>>> Field('{}_tags_secondary'.format(n), 'list:reference >>>>>>> tags', >>>>>>> requires=IS_IN_DB(db, 'tags.id', '%(tag)s', >>>>>>> multiple=True)), >>>>>>> Field('{}_tags_ahead'.format(n), 'list:reference >>>>>>> tags', >>>>>>> requires=IS_IN_DB(db, 'tags.id', '%(tag)s', >>>>>>> multiple=True)), >>>>>>> Field('{}_npcs'.format(n), 'list:reference npcs', >>>>>>> requires=IS_IN_DB(db, 'npcs.id', '%(name)s' >>>>>>> , >>>>>>> multiple=True)), >>>>>>> Field('{}_locations'.format(n), 'list:reference >>>>>>> locations', >>>>>>> requires=IS_IN_DB(db, 'locations.id', >>>>>>> '%(map_location)s', >>>>>>> multiple=True)), >>>>>>> Field('{}_instructions'.format(n), >>>>>>> 'list:reference step_instructions', >>>>>>> requires=IS_IN_DB(db, 'step_instructions.id >>>>>>> ', >>>>>>> '%(instruction_label)s', >>>>>>> multiple=True)), >>>>>>> Field('{}_hints'.format(n), 'list:reference >>>>>>> step_hints', >>>>>>> requires=IS_IN_DB(db, 'step_hints.id', >>>>>>> '%(hint_label)s', >>>>>>> multiple=True)), >>>>>>> Field('{}_step_type'.format(n), 'list:reference >>>>>>> step_types', >>>>>>> requires=IS_IN_DB(db, 'step_types.id', >>>>>>> '%(step_type)s', >>>>>>> multiple=True)), >>>>>>> Field('{}_image_template'.format(n), 'string')] >>>>>>> flds.extend(fbs) >>>>>>> form = SQLFORM.factory(*flds) >>>>>>> >>>>>>> >>>>>>> if form.process(keepvalues=True).accepted: >>>>>>> vv = request.vars >>>>>>> stepsdata = [] >>>>>>> for n in ['one', 'two', 'three', 'four', 'five']: >>>>>>> nkeys = [k for k in vv.keys() if re.match('{}.*'. >>>>>>> format(n), k)] >>>>>>> filledfields = [k for k in nkeys if vv[k] not in ['' >>>>>>> , None]] >>>>>>> if filledfields: >>>>>>> ndict = {k: vv[k] for k in nkeys} >>>>>>> stepsdata.append(ndict) >>>>>>> if isinstance(vv['words'], list): >>>>>>> wordlists = [w.split('|') for w in vv['words']] >>>>>>> else: >>>>>>> wordlists = [vv['words'].split('|')] >>>>>>> paths = self.make_path(wordlists, >>>>>>> label_template=vv.label_template, >>>>>>> stepsdata=stepsdata, >>>>>>> testing=vv.testing, >>>>>>> avoid=vv.avoid, >>>>>>> aligned=vv.aligned >>>>>>> ) >>>>>>> message, output = self.make_output(paths) >>>>>>> >>>>>>> >>>>>>> elif form.errors: >>>>>>> message = BEAUTIFY(form.errors) >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Wednesday, August 12, 2015 at 11:04:46 AM UTC-4, Richard wrote: >>>>>>>> >>>>>>>> Could you show your model and controller... >>>>>>>> >>>>>>>> This make no sens... >>>>>>>> >>>>>>>> Richard >>>>>>>> >>>>>>>> On Wed, Aug 12, 2015 at 10:45 AM, Ian W. Scott <scot...@gmail.com> >>>>>>>> wrote: >>>>>>>> >>>>>>>>> I never got any suggestions on this, even though it seems like a >>>>>>>>> significant limitation of the widget. Has anyone come up with a >>>>>>>>> solution >>>>>>>>> for keeping all the values in a list:string field after form >>>>>>>>> submission? >>>>>>>>> >>>>>>>>> Thanks. >>>>>>>>> >>>>>>>>> >>>>>>>>> On Wednesday, June 25, 2014 at 11:33:26 AM UTC-4, Ian W. Scott >>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>> I've got a SQLFORM.factory form set to keep values after >>>>>>>>>> processing with process(keepvalues=True). But it doesn't work on a >>>>>>>>>> list:string field. The (otherwise very nice) widget loses all but >>>>>>>>>> the first >>>>>>>>>> value when the form is submitted (i.e., all but the first text >>>>>>>>>> inputs for >>>>>>>>>> the field disappear). Is there any way to carry those other text >>>>>>>>>> inputs and >>>>>>>>>> their values over? >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>> Resources: >>>>>>>>> - http://web2py.com >>>>>>>>> - http://web2py.com/book (Documentation) >>>>>>>>> - http://github.com/web2py/web2py (Source code) >>>>>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>>>>>>> --- >>>>>>>>> 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+un...@googlegroups.com. >>>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>> Resources: >>>>>>> - http://web2py.com >>>>>>> - http://web2py.com/book (Documentation) >>>>>>> - http://github.com/web2py/web2py (Source code) >>>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>>>>> --- >>>>>>> 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+un...@googlegroups.com. >>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>> >>>>>> >>>>>> -- >>>>> Resources: >>>>> - http://web2py.com >>>>> - http://web2py.com/book (Documentation) >>>>> - http://github.com/web2py/web2py (Source code) >>>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>>> --- >>>>> 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+un...@googlegroups.com. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >>> Resources: >>> - http://web2py.com >>> - http://web2py.com/book (Documentation) >>> - http://github.com/web2py/web2py (Source code) >>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>> --- >>> 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/d/optout. >>> >> >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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/d/optout.