Hi, Massimo,
thanks for the solution, it looks totally fine but I just wasn't clear
enough on this - my bad.
The thing is I'm using crud.update() to generate the form I described
earlier. How would I adapt your code to crud? I could use "onaccept" but
it's triggered after the update nad before redirect. In my case I must
influence crud.update() so it performs the additional action I need *during*the
update.
On Monday, July 22, 2013 12:20:38 AM UTC+2, Massimo Di Pierro wrote:
>
> How about this?
>
> record = db.table[id]
> newfieldvalues = {'field_X':'value', ....}
> if record.field_X == 'B': del newfieldvalues['field_X']
> record.update_record(**newfieldvalues)
>
>
> if db.table[id].field_X == A:
> #perform full update
> elif db.table[id].field_X == B:
> #update all fields except field_X
>
>
>
> On Sunday, 21 July 2013 08:11:44 UTC-5, lesssugar wrote:
>>
>> When going to update page I would like to check the value of field_X.
>> Then, depending on its current value, field_X should be updated along with
>> the other fields OR be excluded from upload:
>>
>> if db.table[id].field_X == A:
>> #perform full update
>> elif db.table[id].field_X == B:
>> #update all fields except field_X
>>
>> Not sure how to achieve this. Ideas?
>>
>
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.