Carlos, In my simple case, the work around is easy. Just do a redirect back to the edit function.
I wonder how it works if I hand build the form, or use CRUD... On Nov 3, 3:03 pm, Carlos <[email protected]> wrote: > Hi, > > I have the exact same problem for uploads, check boxes and radio buttons > ... so far. > > The way I solved (worked-around) it: > > ... after form.accepts ... > eltable = form[0] > > prefix = nube.hwrapper_upload > def getv(basename): > return form.vars.get(basename) > > # regenerate upload widgets. > for field in factoryfields: > if field.x_isupload(): > fname = field.name > fvalue = getv(fname) > if fvalue is not None: # check vs None in order to > support deletes. > el = eltable.element(_id=prefix+fname) > h2 = nube_upload_widget(field, fvalue, > download_url=urldownload) > el[0] = h2 > > # same occurs for boolean checkboxes. > # but instead of regenerating them we will update the > 'checked' attribute as necessary. > for field in factoryfields: > if field.type == 'boolean' and not field.widget: > fname = field.name > fvalue = getv(fname) > el = eltable.element(_name=fname) > el['_checked'] = 'checked' if fvalue else None > > # same occurs for radios - see above comment for checkboxes. > els = eltable.elements(_type='radio') > if els: > elgroups = dict() > for el in els: > xlist = dict_setif(elgroups, el['_name'], []) > xlist.append(el) > for wname, wlist in elgroups.items(): > v = getv(wname) > for el in wlist: > wv = 'checked' if v == el['_value'] else None > el['_checked'] = wv > > I hope the above helps. > > Carlos

