Multiple Problem in Repeat Group

pkjoshi

Active Member
Problem-1
I have observed in the latest GITHUB that autofill is filling the value in the target field as in the last row. That is if for example in the first row autofill is filled with 250, then in the second row value filled is 125, the value of 1st row is also getting changed to 125.

Note: This I have tested by replacing the form autofill plugin from older GITHUB, which is working correctly.

Problem-2
Calc results are shown in the list correctly for calc fields in repeat group, but not in the form view (both edit view and detail view)
 
For Problem-2
I have identified the location of the problem, which needs to be addressed.
Old GITHUB - where it was working OK, the part of the code in components/com_fabrik/helpers/parent.php around line 740.
PHP:
protected function replaceWithFormData($matches)
    {
        // Merge any join data key val pairs down into the main data array
        $joins = JArrayHelper::getValue($this->_searchData, 'join', array());
        foreach ($joins as $k => $data)
        {
            foreach ($data as $k => $v)
            {
                $this->_searchData[$k] = $v;
            }
        }
 
        $match = $matches[0];
        $orig = $match;
        /* strip the {} */
        $match = JString::substr($match, 1, JString::strlen($match) - 2);

and in the current GITHUB, where the calc results are not displayed in form view

PHP:
protected function replaceWithFormData($matches)
    {
        // Merge any join data key val pairs down into the main data array
        $joins = JArrayHelper::getValue($this->_searchData, 'join', array());
        foreach ($joins as $k => $data)
        {
            foreach ($data as $k => $v)
            {
                /*
                * Only replace if we haven't explicitly set the key in _searchData.
                * Otherwise, calc element in repeat group uses all repeating groups values rather than the
                * current one that the plugin sets when it fire its Ajax request.
                */
                if (!array_key_exists($k, $this->_searchData))
                {
                    $this->_searchData[$k] = $v;
                }
            }
        }
 
        $match = $matches[0];
        $orig = $match;
        /* strip the {} */
        $match = JString::substr($match, 1, JString::strlen($match) - 2);
 
OK, the calc issue should be fixed. Although you didn't give us any info about your element settings, but I'm assuming the problem was if "Calc on save only" is set to No.

So is your autofill plugin on the same repeat group, or a different group?

Can you provide more information about your setup? What element type is the observed element? Are you using a trigger? Etc. A screenshot of the plugin settings would be good.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top