Show/Hide elements on Details page

Status
Not open for further replies.
Dears,
I have been able to implement showing/hiding of elements on a form (based upon value selected by a user for another element) using the change/click events and associated Javascript code within the element.

Although it seems that it isn't as straight forward to implement the same showing/hiding of elements on a Details page. After reading several threads and the Wiki documentation I found that Javascript code needs to go into a file details_X.js within the components/com_fabrik/js folder. Details here:
http://fabrikar.com/forums/index.php?wiki/javascript/

Is this the only method, or am I missing something very simple...!...?
And if this is the only method, then I have a few more questions, which I shall ask based upon the answer.

Thanks for continued support!

~aD
 
I think you may be missing something pretty simple. You can use the Javascript options available on the elements to do some show and hide behavior. Click into an element you created. Click the "Javascript" tab/button on the left. Then click the green "add" button. There they have some options for you to choose from.

For hide, I usually start by setting the event to Load (as in, on a page load) and set the action to "hide" if a given element does not have a condition me. you can set all of these conditions using Fabrik's default dropdown options.

EDIT: Attached is a screen cap of how some show/hide js commands turn out in fabrik.

I hope that helps!
 

Attachments

  • load-change-hide.jpg
    load-change-hide.jpg
    172.9 KB · Views: 97
Last edited:
Thanks for your reply @SoilentRed.
I investigated further and found that if "Predefined Actions" are used then it all works fine... But as soon as I try to put my own code in the Javascript things start falling apart. And I done all the development using custom code, as I have a lot of hiding/showing of elements happening on the form, based upon value of those elements.

Also, in my custom JS code, I have been using the below code to discover element(s)...
var temp = Fabrik.getBlock('form_X').formElements.get('table_name___element_name');
And this code won't find the element on the Details page... Thus I need to either move to the predefined actions or modify my JS code to work on all form(s) and detail(s) pages.

@troester, @lousyfool, @cheesegrits and other members... How can I see the Javascript created by the Fabrik "Predefined Actions"?
Seems my custom JS script has something which is causing issues/conflicts.

Thanks in advance.

~aD
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top