[SOLVED] element updated in default

Hi everyone,
I have a members list and I need an element that is implemented every year at renewal by adding a new code

E.g. it now contains 2024 and upon updating it will have to contain 2024 - 2025

How can I do it?

Thank you
 
You can do this in many ways.
It depends on what you want to achieve.
For example, in a field element, you can simply enter default: {year} and it will return the current year.
You can use the seguence element to get something like 2024-001 etc.
But it depends on where you want the year to be shown and especially when
 
E.g. it now contains 2024 and upon updating it will have to contain 2024 - 2025
Not sure what you mean:

Do want to have an element with a "dynamic" default value?
Then you can use a placeholder or sequence as mentioned by @elmarra or use the Eval option for the default.
But default values are only applied if you are creating a new record.

If you want to update an element in an existing record it depends on your workflow.
What exactly should happen on "renewal"?
 
If you want to update an element in an existing record it depends on your workflow.
What exactly should happen on "renewal"?
Exactly I want to update an existing element

the existing element must contain the years in which the member renewed the membership.

so it must read the existing field and add the new year to ace.

EX.
memberyears of membership
Mario2020 - 2021
Luca2020 - 2023 - 2024


if these members renew it must become
memberyears of membership
Mario2020 - 2021 - 2025
Luca2020 - 2023 - 2024 - 2025
 
In your renewal form you can add a php form plugin doing the database update on your members list.
 
for some fields where I have to completely replace the data I used this php and it works perfectly

$formModel->data['table___element']='abc';
$formModel->data['table___element_raw']='abc';

for the field years of membership but I have to keep the previous years how do I change it?

Sorry but I'm doing it for an association and it's not my real job to make sites and I don't know php that well

Thanks for the help
 
solved I used

$formModel->data['table___element']='{table___elemen} - abc';
$formModel->data['table___element_raw']='{table___elemen} - abc';
 
Back
Top