0

Can I do a nested AND / OR statement in Joomla! showon?

At present if a field is hidden but selected then my other field will show.

So:

Type of Vehicle

  • Car
  • Bike

Car Make

  • Alpha
  • Ford
  • Skoda

Car Colour

  • Red
  • Blue

If it is a car AND it is an alpha OR a skoda then show the option for colour. At present it requires

if (car) AND (alpha OR skoda) but we can't do that in Showon can we?

Also, if we have a statement that says if it's a Car then show the Make option that will work. Then we have the Alpha OR Skoda statement for the Colour we have an issue.

But if we choose Car, then we select Alpha OR Skoda, then we go back and change Car to Bike the Colour option will remain in sight because Alpha or Skoda is still selected even though it is not visible. Can we avoid that or do we need to provide additional validation?

2

update

(removed my incorrect answer)

I was looking at the JS that parses these showons and it seems that using more than one AND/OR chain isn't going to produce correct results. Only the last pair's results will be used as the deciding factor.

eg: foo:1[AND]bar:2[OR]bar:3 is effectively shortened to bar:2[OR]bar:3.

Not what you want.

  • Nice. Good information. So it sounds like someone could make good pull request for this stuff. Probably not me unfortunately. – Eoin Feb 3 '18 at 15:49

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.