Visibility rules-two conditions

  • Doboszj
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 0

Doboszj created the topic: Visibility rules-two conditions

Hello,

I have 3 Select List:

Groups_W
Localization
Range

I would like to set visibilty rules like this:

turn off element Groups_W if Localization isnot City_W
turn off element Groups_W if Range isnot Step_one
turn on element Groups_W if Localization is City_W
turn on element Groups_W if Range is Step_one

With only one off/on rule it works fine but with two on/off rules it has problem with proper turning off lists on form start. I have read that better way is to create ActionScript.

Could You give me exapmle code with my conditions?

Regards
Luck
#234716
  • Posts: 2282
  • Karma: 84
  • Thank you received: 306

mihaela replied the topic: Visibility rules-two conditions

Hello,

Yes, since you have multiple conditions for visibility rules you should use JavaScript visibility rules as explained in this piece of documentation crosstec.org/en/support/online-documenta...s-in-javascript.html .

Should the element Groups_W be shown in case both City_W and Step_one are selected or in case one of the options is selected?

Regards,

Mihaela
#234719
  • Doboszj
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 0

Doboszj replied the topic: Visibility rules-two conditions

In case one of the options is selected.

Regards
Luck
#234720
  • Posts: 2282
  • Karma: 84
  • Thank you received: 306

mihaela replied the topic: Visibility rules-two conditions

Ok, then this is an example of the code for Actionscript for your case:
function ff_elementname_action(element, action) {
if (ff_getElementByName('Localization').value == "City_W"  ||  ff_getElementByName('Range ').value == "Step_one") {
    bfToggleFields('on','element','Groups_W ',bfDeactivateField);
 else {
 	bfToggleFields('off','element','Groups_W ',bfDeactivateField);
 }

 }
NOTE: elementname has to be replaced with the name of the element for which you are writing the Actipscript.

Regards,

Mihaela
#234721
  • Doboszj
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 0

Doboszj replied the topic: Visibility rules-two conditions

Is there a possibilty to make one condition on Visibility rules wchich starts at the begining:

turn off element Groups_W if Localization isnot City_W
turn on element Groups_W if Localization is City_W

and second condition:

turn off element Groups_W if Range isnot Step_one
turn on element Groups_W if Range is Step_one

in ActionScript on Range Select List?

Regards
Luck
#234727
  • Posts: 2282
  • Karma: 84
  • Thank you received: 306

mihaela replied the topic: Visibility rules-two conditions

Hello again,

Can you please explain a bit more what you mean?

If you mean that on form load element "Groups_W" is displayed in case "Localization" is set to "City_W" or Range is set to Step_one, then you should copy the suggested code:
if (ff_getElementByName('Localization').value == "City_W"  ||  ff_getElementByName('Range ').value == "Step_one") {
    bfToggleFields('on','element','Groups_W ',bfDeactivateField);
 else {
 	bfToggleFields('off','element','Groups_W ',bfDeactivateField);
 }
into Initialization script inside code framework. Also, make sure to check the "Page entry" checkbox.

Let me know whether this is what you wanted to know.

Regards,

Mihaela
#234745
Moderators: ForumSupporttomeperica
Time to create page: 0.066 seconds

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99€

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here