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

Hiding elements

Discussion in 'Community' started by digitalDave, Dec 2, 2019 at 10:26 AM.

  1. digitalDave

    digitalDave New Member

    Level: Community
    Hello
    I have a tabbed form, on one of these tabs are repeat groups.
    There are four field elements in the repeat group

    house_boat_93_repeat___fore_aft_centre_a
    house_boat_93_repeat___fore_aft_centre_b
    house_boat_93_repeat___fore_aft_centre_c
    house_boat_93_repeat___fore_aft_centre_d

    I want to hide one of the fields elements on load, but only on the first repeat.
    I have placed this code in the inline javascript section of an element which is not on a repeat group.
    Code (Javascript):
    hideInputFields(this);
    Then in form_X.js I have this

    Code (Javascript):

    function hideInputFields(el){
                 var elem = 'house_boat_93_repeat___fore_aft_centre_a_0';
                 console.log("hide this element: ",elem);
                 el.form.formElements.get(elem).hide();
                  }
    What happens is that 'house_boat_93_repeat___fore_aft_centre_d' is hidden on all rows and 'house_boat_93_repeat___fore_aft_centre_a' is still visible

    I am unsure if I am using the wrong approach or have made a mistake?
     
    Last edited: Dec 2, 2019 at 12:41 PM
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    The code looks OK, although I would delay running the function till Fabrik has finished loading:

    Have you tried putting a breakpoint in your code, and poking around?

    -- hugh
     
  3. digitalDave

    digitalDave New Member

    Level: Community
    Hugh
    I haven't done either of those things, but I will today and report the results.
     
  4. digitalDave

    digitalDave New Member

    Level: Community
    Hello
    I placed some break points in, but didn't really see anything, however I am only an amateur.

    I did however create a new database, new table and form with and 2 groups, 2 field elements on each.

    This allowed me to make the following observations.

    When the group repeat template is set to table, it hides the element that is closest to the fabrik group repeater buttons, no matter what element name I use and on every new repeat group opened.

    When the group repeat template is set to list, it hides the correct element but on every repeat, rather than just the first one.

    Setting the form template to either bootstrap or bootstrap-tabs has no effect.

    I'm not quite sure what to try next?
     
  5. digitalDave

    digitalDave New Member

    Level: Community
    Hugh
    could you also let me know how to delay running code until fabrik has loaded?
     

Share This Page