problem with databasejoin description field in repeating group

guguganmo

New Member
Hello,

i've got some problem with databasejoin decription field in repeating group when i create a new form:

when i create a new group, the 2nd or 3rd repeated element , on changing value, changes the description field of the 1st...

stbsoft.free.fr/fabrik/

Any ideas?

Best regards

Matthias
 
I found a solution to my problem

Result: stbsoft.free.fr/fabrikDBJ_RGSolution/

Edit:
plugins\fabrik_element\databasejoin\databasejoin.php line 1394

Code:
  //MATTHIAS
            //i add repeatcounter;
            $html[] = '<div class="dbjoin-description_'.$repeatCounter.'">';
            $opts = $this->_getOptionVals($data, $repeatCounter);
         
            $default_val = JArrayHelper::getValue($default, 0);
 
            for ($i = 0; $i < count($opts); $i++)
            {
                $opt = $opts[$i];
                $display = $opt->value == $default_val ? '' : 'none';
                $c = $this->showPleaseSelect() ? $i + 1 : $i;
                //i add repeatcounter in class notice description_
                $html[] = '<div style="display:' . $display . '" class="notice description_'.$repeatCounter.'-' . $c . '">' . $opt->description . '</div>';
            }
 
            $html[] = '</div>';

\media\com_fabrik\js\form.js line1651

Code:
//MATTHIAS
                        if (input.nextElementSibling)
                        {
                        var theNextElementSibling = input.nextElementSibling;
                        var elementClass = input.nextElementSibling.className;
                        var elementBase = elementClass.substr(0, elementClass.length-1);
                        // if the element to duplicacte is dbjoin-description_
                            if ( elementBase == "dbjoin-description_")
                            {
                                //i add group number in css class
                                theNextElementSibling.className = elementBase+c;
                                //children's css class too
                                if (theNextElementSibling.nextSibling.parentNode.children[1])
                                {
                                var theNotices = theNextElementSibling.nextSibling.parentNode.children[1].children;
                                var theNotice ="";
                                var theModifiedNotice ="";
                                for(var i in theNotices){
                                  if(theNotices[i].className){
                                   theNotice = theNotices[i].className;
                                   theModifiedNotice = theNotice.replace(theNotice.charAt(theNotice.length-3), c);
                                   theNotices[i].className = theModifiedNotice;
                                   theNotices[i].setStyle('display', 'none');
                                  }
                                }
                            
                                }
                            }

                        }

\plugins\fabrik_element\databasejoin\databasejoin.js function showDesc line 594

Code:
    showDesc: function (e) {
        //MATTHIAS
        //no index for repeated notice description so:
        //get group from  element id
        var elementId = e.target.id;
        var theGroupId  = elementId.charAt(elementId.length-1);
        var theIndex = e.target.selectedIndex;
        var c = this.getContainer().getElement('.dbjoin-description_'+theGroupId);
        var show = c.getElement('.description_'+theGroupId+'-'+theIndex);
        
        c.getElements('.notice').each(function (d) {
        var dClass= d.className;
        if(dClass.charAt(dClass.length-3) == theGroupId){
            if (d === show) {
                var myfx = new Fx.Tween(show, {'property': 'opacity',
                    'duration': 400,
                    'transition': Fx.Transitions.linear
                });
                myfx.set(0);
                d.setStyle('display', '');
                myfx.start(0, 1);
            } else {
                d.setStyle('display', 'none');
            }
            }
        });
    },

Best regards
Matthias
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top