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

How to disable the add and delete group

Discussion in 'Standard Support' started by teoyh, Nov 2, 2010.

  1. teoyh

    teoyh Member

    Level: Community
    Can someone kindly advise me if its possible to disable both the add and delete group after the initial data is submitted by the user.

    Initially I want to allow the user to submit as many as he want. But once he had submitted , the form is route to another user whom will input the rest of the infomation.

    Therefore i need to disable add and delete group button or function in the repeat group so that the next person taking over cannot add or delete the original user entry.

    He will input the information based on the first user setting.

    I did consider using the limit repeat but it cannot be apply here even i can limit add i also need to prevent the user from limiting the delete button group.

    Many thanks
     

    Attached Files:

  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Hmmmm. The easiest way would be to

    1) Copy the table (Tables tab on fabrik backend, select original table, hit Copy button), so you have a complete new set of table/form/group(s)/elements for that form that can be configured separately. Don't worry, copies still operate on the same underlying table and data, it's just a way of having an alternate "view" onto the data.

    [It usually helps at this point if you re-label the copies of table, form and group(s), to help avoid confusion. The new ones will be the ones with higher numeric ID's]

    2) Create a new J! menu for the second level users to access the copy of the table through.

    3) Create a new form template by copying whatever template folder you use for the original (say 'default') from ./components/com_fabrik/views/form/tmpl/default to default_no_repeat (or some such).

    4) In that new folder, create a custom.css with this in it:

    Code (Text):
    .fabrikGroupRepeater {
       display: none !important
    }

    4) Select that as the form template for the copy of your form.

    -- hugh
     
  3. teoyh

    teoyh Member

    Level: Community
    Thank you very much for your reply. But the user prefer to work on the same level of form rather than on a separate form.

    Is there an alternative to what you have proposed.

    Thanks a million.
     
  4. rob

    rob Administrator Staff Member

    Level: Community
    using mootools 1.2.x the code would look like this:

    Code (Text):

    if(document.getElement('input[name=rowid]').get('value') == ''){
      $('groupX').getElement('.fabrikGroupRepeater').destroy();
    }
     
    replace the X in groupX with the group id whose repeat buttons you want to remove

    -Rob
     
  5. teoyh

    teoyh Member

    Level: Community
    Thank you so much for your reply. Is there any requirement to run 1.2.x ?
     
  6. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Well, only that a) that code won't work on 1.11, and b) we're REALLY trying to get away from Moo 1.11, and only work with 1.2.x from here on. We could give you the 1.11 code, but then we'd have to kill you. ;)

    BTW, is there any requirement for the original user to be able to edit the record and add / remove groups? That was why i suggested the two teir approach, so that the original author can edit via one link, and can see the group buttons, and the second level folk edit through another link, and can't.

    if you need the original user to be able to edit and add/remove groups using the JS method Rob outlined ... it won't work.

    Oh, the code Rob gave could either be used in the onLoad function in a form JS plugin, or wrapped in a domReady event in a static form JS file (./components/com_fabrik/js/X.js, where X is your numeric form ID), like ...

    window.addEvent('domReady', function() {
    ... rob's code goes here ...
    });

    -- hugh


    -- hugh
     
  7. teoyh

    teoyh Member

    Level: Community
    When I turn on 1.2 my form break and cannot display properly.
     
  8. teoyh

    teoyh Member

    Level: Community
    Also when i test it in IE8 there is an error message stack overflow at line 8.
     
  9. rob

    rob Administrator Staff Member

    Level: Community
    which url and error message? :D
     

Share This Page