Sorry, the problem also occurs in the new appdmin.
[image: Imagem inline 1]
after submit:
[image: Imagem inline 2]

after refresh:
[image: Imagem inline 3]



2017-11-16 19:01 GMT-03:00 Junior Phanter <junior.co...@gmail.com>:

> problem on *edit record* using *custom forms* and *compute field*.
>
> In old appadmin there is the same problem, however, just replace the old
> appadmin with the new one and it works. In the old version of appadmin,
> in one edition, the value of the compute field was not shown, and in the
> current version there was change, I believe the problem is there. In
> custom form, compute field is not a gluon component, but a string.
>
> edit record1:
> [image: Imagem inline 2]
> error on submit:
>
> in console: print form.errors
> ​[image: Imagem inline 1]
>
> mysum is a compute Field
>
> my model:
>
> def mysum(a,b):
>     a=int(a)
>     b=int(b)
>     return a+b
> db.define_table('mytable',
>                 Field('number1','integer'),
>                 Field('number2','integer'),
>                 Field('mysum', 'integer', compute=lambda row:
> mysum(row['number1'], row['number2']))
>                 )
>
> my controller:
>
> def index():
>     if request.args(0):
>         form=SQLFORM(db.mytable, request.args(0)).process()
>     else:
>         form=SQLFORM(db.mytable).process()
>     if form.accepted:
>         response.flash="Ok"
>     else:
>         print form.errors
>         response.falsh=form.errors
>     return dict(form=form)
>
> my view:
>
> {{extend 'layout.html'}}
>
> {{block header}}
> <center style="background-color: #333; color:white; padding:30px">
>   <h1>/{{=request.application}}/{{=request.controller}}/{{=
> request.function}}
> </center>
> {{end}}
>
> {{=form.custom.begin}}
>     <div>Number1</div>
>     {{=form.custom.widget.number1}}
>     <br>
>     <div>Number2</div>
>     {{=form.custom.widget.number2}}
>     <br>
>     {{=form.custom.submit}}
> {{=form.custom.end}}
>
> 2017-11-16 14:29 GMT-03:00 Yoel Benítez Fonseca <ybenit...@gmail.com>:
>
>> Massimo, i have tried but can't reproduce the error, maybe this was my
>> bad.
>>
>> Sorry for the trouble.
>>
>> On Tue, 14 Nov 2017 11:33:15 -0800 (PST)
>> Massimo Di Pierro <massimo.dipie...@gmail.com> wrote:
>>
>> > Can you send me a simple app to reproduce the problem.
>> >
>> > On Tuesday, 14 November 2017 12:20:03 UTC-6, Yoel Benitez Fonseca
>> > wrote:
>> > >
>> > > Got some strange result after the updates... im ussing pytest for
>> > > testing and the was a test for a submit form with was working últil
>> > > the update, the model:
>> > >
>> > >     db.define_table(
>> > >         'producto',
>> > >         Field('nombre', 'string', length=50, unique=True,
>> > > label='Nombre:'),
>> > >         Field('tipo_producto_id', 'reference tipo_producto',
>> > > label='Tipo:'),
>> > >         Field('precio', 'float', label='Precio:'),
>> > >         Field('descripcion', 'text', length=1250,
>> > > label='Descripción:'), Field('imagen', 'upload', label='Imagen:'),
>> > >         Field('thumb', 'upload', writable=False, readable=False),
>> > >         format='%(nombre)s')
>> > >
>> > > The test will fail for db.tipo_producto_id allowing not in db
>> > > reference....until i got the to the code and explicity put the
>> > > validator:
>> > >
>> > >     db.producto.tipo_producto_id.requires = IS_IN_DB(
>> > >         db, 'tipo_producto.id', '%(nombre)s'
>> > >     )
>> > >
>> > > idk what was that about... other models defined on the app and not
>> > > defining explicid validator work as usual.
>> > >
>> > > 2017-11-14 10:01 GMT-05:00 Massimo Di Pierro
>> > > <massimo.dipie...@gmail.com>:
>> > > > check your models/menu.py you may have separators in the menu.
>> > > > The new layout does not support them.
>> > > >
>> > > >
>> > > > On Tuesday, 14 November 2017 02:22:51 UTC-6, 黄祥 wrote:
>> > > >>
>> > > >> Traceback (most recent call last):
>> > > >>   File
>> > > >> "/Users/MacBookPro/project/python/web2py/gluon/restricted.py",
>> > > line
>> > > >> 219, in restricted
>> > > >>     exec(ccode, environment)
>> > > >>   File
>> > > >>
>> > > "/Users/MacBookPro/project/python/web2py/applications/test/
>> views/default/index.html",
>> > >
>> > > >> line 60, in <module>
>> > > >>   File "/Users/MacBookPro/project/python/web2py/gluon/html.py",
>> > > >> line
>> > > 783,
>> > > >> in __getitem__
>> > > >>     return self.components[i]
>> > > >> IndexError: list index out of range
>> > > >>
>> > > >> views/default/index.html
>> > > >> {{extend 'layout.html'}}
>> > > >> {{include 'templates/index/index.html'}}
>> > > >>
>> > > >> views/templates/index/index.html
>> > > >> {{=H1(T('Test'), _align = 'Center' ) }}
>> > > >>
>> > > >> code in traceback line 60 is italic and bold:
>> > > >> for _item in response.menu or []:
>> > > >>     response.write('\n          ', escape=False)
>> > > >>     if len(_item)<4 or not _item[3]:
>> > > >>         response.write('\n          <li class="nav-item ',
>> > > escape=False)
>> > > >>         if _item[1]:
>> > > >>             response.write('active', escape=False)
>> > > >>             pass
>> > > >>         response.write('">\n            <a class="nav-link"
>> > > >> href="', escape=False)
>> > > >>         response.write(_item[2])
>> > > >>         response.write('">', escape=False)
>> > > >>         response.write(_item[0])
>> > > >>         response.write('</a>\n          </li>\n          ',
>> > > escape=False)
>> > > >>     else:
>> > > >>         response.write('\n          <li class="nav-item
>> > > >> dropdown">\n <a class="nav-link dropdown-toggle" href="',
>> > > >> escape=False) response.write(_item[2])
>> > > >>         response.write('" data-toggle="dropdown"
>> > > >> aria-haspopup="true" aria-expanded="false">', escape=False)
>> > > >>         response.write(_item[0])
>> > > >>         response.write('</a>\n            <div
>> > > >> class="dropdown-menu">\n ', escape=False)
>> > > >>         for _subitem in _item[3]:
>> > > >>             response.write('\n              <a
>> > > >> class="dropdown-item" href="', escape=False)
>> > > >>             response.write(_subitem[2])
>> > > >>             response.write('">', escape=False)
>> > > >>             response.write(_subitem[0])
>> > > >>             response.write('</a>\n              ', escape=False)
>> > > >>             pass
>> > > >>         response.write('\n            </div>\n          </li>\n
>> > > >> ', escape=False)
>> > > >>         pass
>> > > >>     response.write('\n          ', escape=False)
>> > > >>     pass
>> > > >
>> > > > --
>> > > > 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.
>> > >
>> > >
>> > >
>> > > --
>> > > Msc. Yoel Benítez Fonseca
>> > > Dpto. Informática. Redacción Adelante
>> > > http://www.adelante.cu/
>> > >
>> >
>>
>> --
>> 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.

Reply via email to