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

Hide and unhide a field based on another field doesn't work

Firstly, you should never "cherry pick" files from GitHub. Always do a full update. This is because changes in one file in git may well depend on changes in other files, and you can wind up with very subtle, nasty bugs if you have mismatching files.

As for the actual issue ... did you reload JS in your browser? Easiest way is to open dev tools (ctrl-shift-i) in Chrome, then right click on the normal reload button in the brower, and "Empty cache and hard reload".

-- hugh
 
Thank you Hugh,
I had the latest version of fabrik and plugin installed before, so first I thought that as I have last version everything should work. Now I don't know should I install again fabrik 3.9 to cancel changes I make getting files from git.
 
Ok, I change files, took them from 3.9 fabrik as I installed it 3 weeks ago,
I did eveything you recommend and still have no results.
I try to use
Code:
var $fiohiddenObj = Fabrik.getBlock('form_1').elements.get('vks___fiohidden');
var $fiohiddenElem = $fiohiddenObj.getElement();
var $fiohiddenElemContainer = $fiohiddenElem.findClassUp('fabrikElementContainer');
$org = this.getValue();
if ($org == '39')
{$orgfioObj.hide();
$fioObj.hide();
$fiohiddenElemContainer.classList.remove('fabrikHide');
  $fiohiddenElemContainer.show();
  }

it's not results I expected, with hide it's ok, but with show


I inspected code in case if this element not hidden this must look as below

Code:
<div class="control-group fabrikElementContainer plg-field fb_el_vks___fiohidden  fabrikDataEmpty  span12">

        <label for="vks___fiohidden" class="fabrikLabel control-label"> Name </label>
  
<div class="controls">
  
    <div class="fabrikElement">
      
<input type="text" id="vks___fiohidden" name="vks___fiohidden" size="10" maxlength="255" class="input-medium form-control fabrikinput inputbox text" value="">
    </div>

    <div class="fabrikErrorMessage">
            </div>


if I use code to show $fiohiddenElemContainer.show();
Code:
<div class="control-group fabrikElementContainer plg-field fb_el_vks___fiohidden" style="display: block;">
    Name
<div class="controls">
  
    <div class="fabrikElement">
      
<input type="hidden" id="vks___fiohidden" name="vks___fiohidden" class="input-medium form-control  hidden fabrikinput inputbox text" value="">
    </div>

    <div class="fabrikErrorMessage">
            </div>
</div>

and I didn't get input field, and no label....it's not look like as in case this element ssign not hidden in form view.
Appreciate any comment. In case I use code like i wrote in the start message i did't show anyting.

joomla version 3.9.12, fabrik version 3.9
 
Your code doesn't make much sense, as orgfioObj and fioObj don't seem to exist, they aren't set up in the code.

And I'm not sure why you are manually finding the container. The following should work ...

Code:
var fiohiddenObj = Fabrik.getBlock('form_1').elements.get('vks___fiohidden');
// you can now hide or show it with ...
fiohiddenObj.hide();
// ... or ...
fiohiddenObj.show();

The hide() and show() methods for the Fabrik element object already hide/show the container ...

https://github.com/Fabrik/fabrik/blob/master/media/com_fabrik/js/element.js#L903

... and as you can see, that original bug with the class being wrong ('.fabrikHide') has been fixed.

-- hugh
 
Thank you Hugh, I understand my mistake. because I download version from site not from git now I update from git and everything is ok.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top