• New Commercial Services Section

    We have now opened a commercial services section here on the forum. If you have a Fabrik project that you wish to have someone work on for you, post it under Help Wanted. If you are an application developer and wish to earn some money helping others, post your details under Fabrik Application Developers.

    Both of these are unmoderated. It will be up to both parties to work out the details and come to an agreement.

show/hide element based on external table data

chris.paschen

Chris Paschen
I have an element on a form that needs to be shown or hidden at the time of form load based upon data in a couple different external tables.

What I did:

Created an element on the form - can_review
On the form - plugin: php - onBeforeLoad
this gets the necessary data and sets the value in the can_review field as 0 or 1
On the can-review element set javascript rules (onLoad) to show/hide the element to be hidden (as I've done on many other occasions). [onLoad if = 1 show; if != 1 hide]

However, even though I can see that the onBeforeLoad function IS working (the value in can_review IS getting set properly), it appears that the javascript isn't having any effect at all on the element to be hidden/shown (it is always shown).
I've also tried other logic for the javascript (if =0 hide; !=0 show, etc.) and still the element is always shown.

Is there a different place to add my form plugin that would allow this to work?
Or is there another way to do this?

(Other javascript entries on the form are working fine)
 
I'm pretty certain your plugin has nothing to do with it, but just for fun, turn that off, and just set your can_review to a static valuie, see if anything changes.

-- hugh
 
Nevermind ... it appears it was an issue with javascript caching.
(But hopefully someone else is trying to do this and this method will help. Just remember to clear cache when testing)
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top