Databasejoin - Add option in front end problem

Bauer

Well-Known Member
I'm using the 'Add option in front end' option in a databasejoin element.

The good news is... the option works and displays the popup form - and then adds the saved new option and sets it as the 'selected' option in the dbj element. Hurrah.

But the bad news is twofold...
  1. The change event for the dbjoin element is never triggered when the new option is added. I have to select another option - and then select the added option again, in order to make the onchange event behave as expected.
  2. The added option seems to ignore the 'order by' setting that was configured in the dbj element - so it always gets added to the bottom of the list options.
I suppose I can live with #2 and realize it would require a complete rebuild of the dbj query in order to set the order/index correctly - but I really need a solution for #1.:eek:
 
Hmmm, it does fire for me. Can you put a breakpoint at line 400 in the databasejoin.js, and see if that gets reached?

Code:
                    if (changed) {
                        self.element.fireEvent('change', new Event.Mock(self.element, 'change'));
                        self.element.fireEvent('blur', new Event.Mock(self.element, 'blur'));
                    }


As for #2, yeah, that's problematic. We don't rebuild the entire dropdown (for reasons I forget, but I think were to do with speed), rather we do more of a sync - add anything which is new, remove anything which doesn't exist any more. And that code has no clue as to what the ordering should be.

-- hugh
 
Yeah I get that. This table used for the join has over 5,300 records - and there really is no need to reindex the list the row being added is the one selected - that will get done when the form is submitted anyhow.

I found my problem. The 'onChange' trigger was being 'stepped on' by a calc element in the same group which was also watching that list. I changed the on change to watch the calc instead and it now works.

But I've got another real stinker today.
I have an element that is not showing in any forms and I have no idea why.

I don't even know when this started happening - but my client pointed it out today. It is an important element in a large table loaded with data and I hate go through all the work needed to save the data, delete the element, and re-add it again (hoping that would 'fix' it). What concerns me more than doing the work is WHY it happened and is happening to begin with. I've never run into anything like this b4 in my 4+ years of using Fabrik.

It's a simple standard field element set as an integer 6,0 - not part of any index.
I removed everything from the element - like tips and validations - and set all Access to Public - but the problem still remains. I renamed all related form_#, list_#, details_# javascript files. I also looked at the structure in the Fabrik elements table and everything (hidden, eval, published, access, etc.) looks OK there too.

It will always show for a flash of a second when the form loads - then disappear.

The fabrikHide class gets added SOMEWHERE / SOMEHOW - and the style changes to style="opacity: 0; visibility: hidden;"

I'm really lost as to where and why this is happening - but it happens in both the form and details view and it occurs in the frontend and backend, using any template.:confused:
 
Last edited:
In Chrome dev tools you can right-click on the element and set "Break on..." = Attributes modification
Maybe this will show you something...
 
Thanks troester - Yeah I did that about 2 hours ago - but am lost as to how to use the debugger.

I found it - onload - javascript. My mistake.:oops:
 
Last edited:
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top