Em sexta-feira, 8 de junho de 2012 12h32min12s UTC-3, Anthony escreveu:
>
> By default, form.process() does an insert of the submitted record. If you 
> don't want that, you can do:
>
> if form.process(..., dbio=False).accepted:
>
> or
>
> if form.validate(...):
>
> The only difference between process() and validate() is that dbio=True by 
> default in process(), and process() returns the form itself rather than the 
> True/False result of the validation.
>


*Thank you so much for the solution, Anthony.*

 

>
> Is there a reason you're not using an update form, though?
>
*
Yes, because the html is already ready, and have other people involved in 
the project. So we're not using {{=form}}. ;)*

 

>
> Anthony
>
> On Friday, June 8, 2012 11:18:50 AM UTC-4, Relsi Hur wrote:
>>
>> Hello,
>>
>> I have a html form, and a action like this:
>>
>> def edit_my_table():
>>     form = SQLFORM(db.my_table)
>>     if form.process(session=None, formname='edit_').accepted:
>>         db(db.my_table.id == request.args[0]).update(my_field = 
>> request.post_vars.my_value)
>>         response.flash = 'OK'
>>     elif form.errors:
>>         response.flash = 'NOK'
>>
>> Well, it is updating 'my_field' in 'my_db' correctly, but it is creating 
>> a new item too, with the same value of the update.
>>
>> Database is sqlite.
>>
>> What am I doing wrong?
>>
>>
>>

Reply via email to