set a singular field when update a specific field

set a singular field when update a specific field

erickmterickmt Posts: 15Questions: 3Answers: 1

I would like that when I update de field 'perfil' the other field 'until_date' was setted by one year from now date. Is that possible?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 62,296Questions: 1Answers: 10,215 Site admin
    Answer ✓

    Absolutely - three options (in order of my personal preference):

    1. Use a database trigger to update the column when the row is created / updated
    2. Use a server-side event to set the value for the field - preCreate and preEdit would be the events to use here.
    3. Use dependent() to set the value on the client-side and submit that new value.

    The reason I've put them in that order is that the db trigger will run regardless of client-side code (i.e. if you update the value in the db directly), while the last one is potentially hackable (would be easy to submit a different value).

    Allan

This discussion has been closed.