Display result in field according to dropdown choices

Pissa

New Member
Hi guys.
I have four dropdown elements.
Every dropdown element has three choices: YES, NO, OK

In another field I want that if all four dropdown elements have OK or NO as choice, the result should be GO.
If even just one of the four have YES as choice, the result shoud be STOP (or alternatively a blank field).

So for example:
OK NO NO NO -> GO
NO NO OK OK -> GO
NO YES OK OK -> STOP

I tried with calc plugin and with cascadingdropdown plugin with no success.
I'm doing something wrong with PHP code for sure.

Any help?!
Thanks!
 
Hi Jenna,
thanks for your help!

I saw your thread, if I understand correctly:
- if in dropdown you select "tel", in tel form it shows tel, while in email form none
- if in dropdown you select "e_mail", in tel form it shows none, while in email form it shows e_mail
- if in dropdown you select "bw", in tel form it shows none, and also in email form it shows none

Is it correct?
 
Hi Pissa,
first it's a dropdown which hides other fields.
so i hide field tel and email on load with a js for each element
than my dropdowwn element toggles view for the different values

sorry can't help at the moment with a code,
maybe coullet is right, i don't know nothing about calc element
 
I think calc element should do the job easily.
What is you php code?

Sorry, deleted it because I tried other method because I couldn't make work it.
Anyway I remember I couldn't make it works because I had problem make it check all the three dropdown concurrently.... any tips?!
 
In a calc element with ajax on

$ddvalues = array ( '{yourtable___DDelement1}', '{yourtable___DDelement2}', '{yourtable___DDelement3}');

$result = 'GO'; // default value

if (in_array('YES', $ddvalues)) {$result='STOP';}

return $result;
 
Hi coullet,
sorry for late answer but I had no internet connection for almost two days!

I tried your JS code, it works perfectly!!
I was completely doing a wrong thing, so without your help I never could do it, many many thanks!

Just a last question: when I change the value in the dropodown field (for example, from YES YES YES to OK OK NO so the 4th fiels should change from STOP to GO), I have to do a manual refresh of the page to see that the field had changed from STOP to GO. I tried to change some settings in the "more" tab in the calc element, without success.
Is it possible to have an automatic change of the result?
 
Just a last question: when I change the value in the dropodown field (for example, from YES YES YES to OK OK NO so the 4th fiels should change from STOP to GO), I have to do a manual refresh of the page to see that the field had changed from STOP to GO. I tried to change some settings in the "more" tab in the calc element, without success.
Is it possible to have an automatic change of the result?

EDIT
I discover that this happens only when editing directly from table using Inline Edit list plugin, that I normally use.
Editing the value in dropdown using the Edit button, changing the value and saving make it works with no problem, probably because the page refreshes.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top