• 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.

YES/NO element problem after upgrade to 3.9

sob_k

Member
Hi everyone
I'm using Joomla 3.9.2 PHP ver. 7.2.11 and of course Fabrik 3.9
After upgrade Fabrik from 3.8.to 3.9, my YES/NO element not working as before. I have hidden some element as usually by JavaScript on load event and on change event. It worked well before upgrade, but now element are always hidden when I change from No to Yes but should be vilible.
I try checkbox or dropdown and it is working as I want, but te problem is that I'm use planty of YES/NO in my
several projects. I can not find a problem.
My themplate using Helix3 - Ajax 2.5.6 and Helix3 Framework 2.5.6 (LT_Optik)
When I change to default Joomla themplate is workig ok.
 
Yes, I try all methods, I try also new version joomla and 3.8 Fabrik and then it worked.
I put this simple code
Code:
  var $type = this.form.formElements.get('pulpit___taknie').getValue();
  alert($type);
But each evet did not work. It looks like there is no reaction to any evet (change click select ect.)
Of course on load event it's work ok.
 
Last edited:
This is what I've in on load event
Code:
var $type = this.form.formElements.get('pulpit___taknie').getValue();
var element1= Fabrik.getBlock('form_8').formElements.get('pulpit___pole');
if ($type=='0')
{
  element1.hide();
}
if ($type=='1')
{
  element1.show();
}
and this is on change
Code:
var $type = this.form.formElements.get('pulpit___taknie').getValue();
var element1= Fabrik.getBlock('form_8').formElements.get('pulpit___pole');
if ($type=='0')
{
  element1.hide();
}
if ($type=='1')
{
  element1.show();
}
And This is what I've in console. I can't set pointer event on YES/NO only for element pulpit___pole
upload_2019-2-11_15-19-8.png
 
Last edited:
I've always used a 'click' event for YesNo elements, and that's still working for me. I have a YesNo on one of my main test forms which shows / hides a group on the form, it's working fine.

Can you try with 'click', and if that doesn't work, point us at the page.

-- hugh
 
Hej,
I also tried radiobutton and as I gave the grouping did not work either. So it's probably a bootstap problem.
I did a bit different - radiobutton without grouping + css and javascript and looks similar to yes no
This, of course, is an emergency exit, it would be great if YES NO worked properly.
 
Last edited:
Hmmm, yeah, looks like it might be a Helix template issue. The event delegation we use for the click event just isn't firing, which it should ... which means something, somewhere is stopping the event propagating after the button group overlay is clicked on.

Can you test with something like Protostar, just to see if it works?

-- hugh
 
Yes it work ok for standard joomla template. I try also new version joomla and 3.8 Fabrik and then it worked fine also in Helix3
 
I'm trying to remember why I removed that in the first place. Which was probably to fix some other issue, which will then resurface if I put it back in ...

-- hugh
 
Not sure if this is any help with the "why", but I've got an element setup similar to what sob_k described (and went through the same head-scratching process until finding this post). I've noticed that when I used the following to alert the value of my element on change (or on click), that the alert is presented twice immediately after the event (not once as I had originally expected).

JavaScript:
var form = Fabrik.getBlock('form_36');
var visitWebsite = form.formElements.get('sales_survey___visit_website');
alert(visitWebsite.get('value'));

The first alert shows the value of what the element had been originally set at and the second shows the updated value. I'm assuming that, depending on what I'm doing within the event, this could present an issue. In my case (and likely sob_k), it probably isn't going to affect much as we really only care about which elements are displayed at the end of whatever is happening. If there were any calculations being run (or something), maybe there's a chance of duplication? Not sure, but thanks to sob_k for posting this and thanks to cheesegrits for replying! I'm going to leave the plugin with line 211 uncommented for my purposes, but will have to keep this noted somewhere if any future version is released without a fix and gets copied over my edited radiobutton.js file.

I also tried the following and noticed that two objects were returned in my alert (didn't include ".get('value')" as part of the alert):

JavaScript:
var form = Fabrik.getBlock('form_36');
var visitWebsite = form.formElements.get('sales_survey___visit_website');
alert(visitWebsite);

So, I found the lines in the source code for this element and realized that it was because the name of the elements is the same (which makes sense). I am just assuming that this is why I get the two alerts. I could be something else. Following the same logic though, as the line I uncommented in the radiobutton.js file that cheesegrits had suggested, adds some class definitions to the variable "str" (that is defined by the preceding line (210) - which references the "name" of the elements), then it might impact the intention to "Get the dom selector that events should be attached to". If the events are attached to something in the class that line 211 adds then this might be part of the issue? Just a wild stab at a guess without a solution (sorry). But if it helps with the "why"...
 
Yes, after I uncommented line 211 in radiobutton.js, the events "on click" and "on load" fired twice when I changed "yes" to "no" or vise-versa in the form (both back-end and front-end templates behaved this way). If I comment out line 211 again, everything works in the back-end only. Having said that, if I switch my front-end theme to Protostar, it also works as expected (when line 211 is commented out), so I do believe the issue is theme related.

Before I uncommented the line, the event didn't fire at all in my front-end theme, but as I just explained above, things did work as expected in the back-end (administrator) and the front-end if I used the Protostar template.

As far as the commit goes, I downloaded a copy of fabrik-master.zip from github on December 6th and loaded everything contained within (so yes).

I'm using an LTheme template (LT bespace) which is built off the Helix3 framework (sob_k also mentioned that his template also uses the Helix3 framework).

Unfortunately, I created my form 2 weeks ago and don't have a version using older versions of joomla or fabrik to confirm whether or not it was working before moving to Joomla 3.9 and/or Fabrik 3.8.

Curious about what altering the radiobutton.js file could affect, I have also found that the ratings element doesn't seem to be working 100% as expected in either the front-end or back-end. Should I create a separate forum thread for that or if it is related to radio buttons, should I add what I've found to this?

Thanks Cheesegrits
 
Separate thread for ratings.

Yeah, the radiobutton JS event stuff is very template sensitive. I seem to recall the reason I took that label line out was to try and mitigate issues. By add the "label for" in our layout, so a click on the label automagically propagates to the input field, I was able to remove the label from the event delegation selector, which (at the time) seemed to fix various issues. But apparently, somehow Helix 3 is preventing the event from propagating.

When I get a few minutes I'll switch to Helix 3 and see what I can see.

-- hugh
 
Thank you so much!

I will create a thread for ratings and include all the details that I've found.

Kudos to you guys for taking on so many of the element plugins that you have. They are super useful to all us admins who get last minute request to just "whip together an app"... With all the themes and complexities, you are heroes to many of us!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top