Visibility rules no longer work

  • Posts: 178
  • Thank you received: 1

ooc created the topic: Visibility rules no longer work

I have a form using visibility rules that did work some time ago. At some point - not sure when - they ceased working and I cannot get them going again. I am attaching the form and one script that it calls.
The form accepts personal information from 1-6 people (in a family) each person having a number of elements in one section. To ensure that the topmost sections are used where fewer than 6 in the family are used I turn off sections 3-6 on entry. If section 2 is used, section 3 is turned on and up until section 6 is turned on.
On the summary page, I only turn on sections that have been filled in.
What I am finding now is that although sections 3-6 are turned off in their advanced properties, as long as I have the visibility rules in place, the sections do display on form entry. If I remove the visibility rules they are off on entry but, of course, they don't turn on when I want them to.
The visibility rules I have (that have worked in the past) are:
turn on section family3 if fname2 isnot !empty
turn on section family4 if fname3 isnot !empty
turn on section family5 if fname4 isnot !empty
turn on section family6 if fname5 isnot !empty
turn off section family2a if fname2 is ?empty
turn off section family3a if fname3 is ?empty
turn off section family4a if fname4 is ?empty
turn off section family5a if fname5 is ?empty
turn off section family6a if fname6 is ?empty

It seems the 'isnot !empty' and 'is ?empty'

File Attachment:

File Name: seasonpass.zip
File Size:46 KB
#235539
Attachments:
  • Posts: 2109
  • Karma: 72
  • Thank you received: 267

mihaela replied the topic: Visibility rules no longer work

Hello,

Please take a look at this topic crosstec.org/en/forums/1-forums/123820-v...ger-work.html#225229 .

From what I can see this is your topic regarding the same issue from about a year ago.

Please try to apply that solution for your form and let me know the result.

Regards,

Mihaela
#235549
  • Posts: 178
  • Thank you received: 1

ooc replied the topic: Visibility rules no longer work

Hello Mihaela
Thank you. I was sure I had asked about this in the past but could not find it. Could you tell me how to find my earlier topics?

All the same though, that topic did not help. As I recall I tried many things and finally got swamped with other problems. First, the 'turn on section sectionname if elementname isnot !empty' seems to turn on elementname even when it is empty - on entry to the form. The second part - isn't actually needed for this form but was copied over from a more complex form so I'd prefer to just focus on the first rules just now.

If I am understanding Marko correctly, I should say 'turn on section sectionname if elementname isnot ''. However I have tried that and on entry elementname is still turned on.

I have tried implementing the visibility rules in javascript using bfToggleFields having read 'Visibility Rules in Javascript' ( crosstec.org/en/support/online-documenta...s-in-javascript.html )
with (for the family3 to be turned on when lname2 is entered)
function ff_lname2_action(element, action)
{
switch (action)
{
case 'change':
alert ('on change action');
return bfToggleFields('on','section','family3',bfDeactivateField);
break;
default:;
} // switch
}
Family3 does not get turned on . I do have the dummy visibility rule entered.
I am not even getting the alert in this case - nor any error in my console.

I am 100% certain these forms worked perfectly 2-5 years ago and then with some upgrade the visibility rules failed. The forms continued to work but not as cleanly. Now we have found that we really need to hide those sections under the given conditions. Hope you can help.

Thanks
Lorna
#235605
  • Posts: 2109
  • Karma: 72
  • Thank you received: 267

mihaela replied the topic: Visibility rules no longer work

Hello,

You can see your old topics by clicking on your username "ooc" in the topics that you have submitted.

As for the visibility rules, the following rule:
turn on section sectionname if elementname isnot !empty
does not work.

Since "!empty" is not a valid value and value entered in the field will always be different from it, the "sectionname" section will be shown all the time.

Usually, in this case, JavaScript visibility rules should be used. Despite that, there is a trick how write regular visibility rule using regex.

Please try to replace the existing visibility rules with the following ones:
turn off section family3 if fname2 isnot ![0-9a-zA-Z]$
turn off section family4 if fname3 isnot ![0-9a-zA-Z]$
turn off section family5 if fname4 isnot ![0-9a-zA-Z]$
turn off section family6 if fname5 isnot ![0-9a-zA-Z]$

turn on section family3 if fname2 is ![0-9a-zA-Z]$
turn on section family4 if fname3 is ![0-9a-zA-Z]$
turn on section family5 if fname4 is ![0-9a-zA-Z]$
turn on section family6 if fname5 is ![0-9a-zA-Z]$
I've tested this on the form you've sent as a package and from what I can see it is working properly.

Please test it yourself and let me know the result.

Regards,

Mihaela
#235613
The following user(s) said Thank You: ooc
Moderators: ForumSupporttomeperica
Time to create page: 0.062 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