1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

YES/NO element problem after upgrade to 3.9

Discussion in 'Community' started by sob_k, Feb 10, 2019.

  1. sob_k

    sob_k Member

    Level: Community
    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.
     
  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    Did you try with "onclick"?
     
  3. sob_k

    sob_k Member

    Level: Community
    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 (Text):
      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: Feb 11, 2019
  4. sob_k

    sob_k Member

    Level: Community
    This is what I've in on load event
    Code (Text):
    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 (Text):
    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: Feb 12, 2019
  5. sob_k

    sob_k Member

    Level: Community
    Friendly bump :)
     
  6. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    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
     
  7. sob_k

    sob_k Member

    Level: Community
    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: Feb 23, 2019
  8. sob_k

    sob_k Member

    Level: Community
  9. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    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
     
  10. sob_k

    sob_k Member

    Level: Community
    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
     
  11. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    So it works in Fabrik 3.8, but not 3.9?

    -- hugh
     
  12. sob_k

    sob_k Member

    Level: Community
    Yes, that's why I wrote here - I thought that maybe some bug had crept in during the update
     
  13. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
  14. sob_k

    sob_k Member

    Level: Community
    Hej, YES IT WORKS NOW !!
    Thanks a lot :)
     
  15. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    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
     
  16. beatty_t

    beatty_t New Member

    Level: Community
    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).

    Code (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):

    Code (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"...
     
  17. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
  18. beatty_t

    beatty_t New Member

    Level: Community
    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
     
  19. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    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
     
  20. beatty_t

    beatty_t New Member

    Level: Community
    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!
     

Share This Page