Best way to update a field based on userinput?

nettemor

Member
I have several fields and checkboxes that should trigger a status update on my order.
Example:
When order_sendt_date is set, i want orderstatus (hidden radiogroup status) to be set to value 2.
Later on the order is changed again, and the mounted_date is set. Then i want orderstatus to be set to value 3.

How and where do i do this ?
 
You can add a form php plugin updating your status element.

Or you can change your status element to be a calculation element.
 
I am really stuck with this so hope you can help out. It sounds so simple but i cannot make it work no matter what i try.
So to break everything down, i have set up a simple simple if test to see if i manage to change the value in the status (calc) object:

This is the php in my calculation object:
if ('{ac_salg___betaling_raw}' = Ja) {
return 'hello';
}

Nothing is returned. The calc field stays blank.
I have set ajax observe field '{ac_salg___betaling}' and i can see that it does some calculation when clicking on/off (betaling checkbox).
I tested return '{ac_salg___betaling_raw}' and this gives me the values of {ac_salg___betaling_raw} if not checked and Ja if checked.
I have tried to put the values within singles '' and doubles "" and all variations i can think of. But no luck. So i need your help.

What is wrong with in the php above ?
 
Not quite there yet, so i want my calc field to update another field.
When user do changes i want to set a special status. And when record is saved the status will hold the correct value and will be saved along with the rest of the record. I am trying: '{ac_salg___status_raw}' == 2;
Not the way to do it obviously. So my question is, how ? And also is this the way you would recommend to do this ? (Basically i need to update the status based on checking several checkboxes and what their values are.) Please advice.

if ('{ac_salg___betaling_raw}' == 'Ja') {
'{ac_salg___status_raw}' == 2;
return 'hello';
} else {
return 'no hello';
}
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top