Condition in php form plugin

georgie

Member
Hello

I would like, after saving a form, update a field of the record according to the value of another field.

I saw there is the php plugin for forms, but what syntax to use to set a condition?

Thank you!
 
A condition to update the element?

or a condition to run the php plugin at all (that's what the "condition" field is for; return false; won't run the php plugin)?
 
I mean the php plugin on the forms.

In fact I would, after submitting a form, set field to 0 if another field contains a particular value submitted in the form.
 
Again thank you !

I use a code like this :

$type = $formModel->formData['projets___type'];
if ($type != 'Projet ROHM')
{
$formModel->updateFormData('projets___budget_rohm', '0' , true);
}

But I would use a "Contain" condition in php. I have tried many syntax, can you help me ?
 
use php's strstr() method or stristr() if you want a case insensitive comparison
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top