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

Dropdown Hide element Show using Javascript

Discussion in 'Community' started by jmoises, Dec 2, 2019 at 8:41 PM.

  1. jmoises

    jmoises Member

    Level: Community
    Ok, i am trying to show and dropdown element that is set to HIDDEN using Javascript depending of the value from a DatabaseJoin element, but is now workin, what happend here is not show the elemente if i set YES the Hidden in the Dropdown, if i set Hidden to No, and in my databasejoin JS create 2 JS one for hide and other for show it works ok, but i am able to view the dropdown element hidde when i open the form so i like to hide the form before the form render. Any adivese is welcome.

    Dropdown Element-
    upload_2019-12-2_12-33-13.png

    JavaScript on my DatabaseJoin element
    upload_2019-12-2_12-37-32.png
     
  2. jmoises

    jmoises Member

    Level: Community
    Ok i try with field element same think in order to hide and element i need to use JS, because if i select Hide = Yes in the element i cant show the element using JS

    Here is the small video that show how the element is Hide onLoad and then show it after select value in dropdown
    https://gyazo.com/bfd48d05c4cef69fb7ba419b5d9e7faa

    and like to hide the element so the user dont notice that.
     
  3. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    You can't show an element if you've set that "Hidden" option. When you set "Hidden", we don't render the element (ie. don't build the select dropdown, or whatever HTML structure the element type uses), we just add it as a simple <input type="hidden" value="foo">, in a hidden group at the end of the form.

    To be able to show it again, you have to use JS to hide it on load. And yes, I'm aware it will sometimes show before it hides, I'm working on a fix for that.

    -- hugh
     
    jmoises likes this.
  4. jmoises

    jmoises Member

    Level: Community
    ok thanks Hugh! now i know!
     
  5. jmoises

    jmoises Member

    Level: Community
    @cheesegrits one question what about if i hide it on the Form_xx.js file? do you think the efect is not show if i do it that way?

    and what code can i use in js to do it_?

    thanks
     
  6. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    The form_X.js file probably won't help, as in order to hide it in such a way that the built in element JS could show it again, you'd need to wait till the Fabrik element object was ready to use, by which time it would have been displayed. That's why it's not an easy issue to solve, hence I haven't solved it yet.

    -- hugh
     
    jmoises likes this.
  7. jmoises

    jmoises Member

    Level: Community
    got it thanks hugh
     

Share This Page