• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Radiobutton element Yes - No

lpro87

New Member
Hello,
Help solve the problem.
There are three radio button elements where the answers are Yes or No.
And there is a fourth element of the radio button, where the answer should become Yes, provided that the other three elements with the answer Yes. And if at least one answer is No, then the fourth element should become No.

In JavaScript, I can do it individually for each of the 3 elements.

var rbVal = this.form.formElements.get('Form___element1').getValue();
if (rbVal == '1') {
this.form.formElements.get('Form___element4').update('1');
}
else if (rbVal == '2') {
this.form.formElements.get('Form___element4').update('2');
}
 

Attachments

  • Elements.jpg
    Elements.jpg
    70.5 KB · Views: 25
Last edited:
Regarding the 4th element, is the user allowed to "override" the pre-selection? In other words, if the 4th element ends up being either Yes or No, can the user still change it to No or Yes, respectively?
If not (which would seem to make sense to me), I'd say it'd be much easier to make the 4th a (hidden) calc element...
 
Regarding the 4th element, is the user allowed to "override" the pre-selection? In other words, if the 4th element ends up being either Yes or No, can the user still change it to No or Yes, respectively?
If not (which would seem to make sense to me), I'd say it'd be much easier to make the 4th a (hidden) calc element...

Yes, the user should not change the fourth element.

It can also be done with the Calc element. It will only answer Yes or No
 
Yes, the user should not change the fourth element
Well, then why give him a radio button? As suggested, instead make it a (hidden) calc element where you set the value with a PHP condition depending on 1st-3rd elements?
 
Thank you.

$num1 = '{Form___element1_raw}';
$num2 = '{Form___element1_raw}';
$num3 = '{Form___element1_raw}';

$array = compact("num1", "num2", "num3");
$countValues = array_count_values($array);
if($countValues[1] == count($array)){
echo "yes";
}
else{
echo "no";
}
 
Last edited:
Code:
$num1 = '{Form___element1_raw}';
$num2 = '{Form___element1_raw}';
$num3 = '{Form___element1_raw}';
if ($num1 == '1' && $num2 == '1' && $num3 == '1') {
    return 'Yes';
} else {
    return 'No';
}
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top