Countains or does not contain in form with php plugin

georgie

Member
Hello

As said in the title, I wish after saving a form, to execute a code that modifies values ??of the record.

I do it already in the same form with condition like "equal to" (==) or "different" (! =). It works very well.
Yes, but now I want to say "that contains" !!! Arf

I put here a complete example of my script that work :

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

And here script wich does not work :
Code:
$variable2 = $formModel->formData['projets___ohm'];
 
$cherche = 'Oyapock';
 
if (strpos($variable2, $cherche) === false)
{
  $formModel->updateFormData('projets___budget_oya', '0' , true);
}
 
It's looking ok, did you set the "process script"?

You can include
var_dump($variable2,strpos($variable2, $cherche));exit;
to see what you get.
 
Thanks

Here a answer when I add var_dump :
Code:
array(2) { [4]=> string(7) "Nunavit" [6]=> string(9) "Tessekere" } NULL

Any Idea ?
 
So your ohm element is multiselect or checkbox etc?
Try with
$v2 = implode(',',$variable2); //gives you one string Nunavit,Tessekere...
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top