Add from front end - Repeat Element

Status
Not open for further replies.

felixkat

Senior Member
I have a repeat element setup, the element is a dbjoin. The option is activated to allow adding from the front end.

If you repeat the element a few times and then add a new entry, the new entry appears at the top of the list leaving the current element blank.


I have created the setup on the demo server. (github as of now 24th May)


On another server I'm working on something slightly different happens with the same setup.

Instead of the new entry appearing at the top, it actually changes every element to the same value, (The newly added value)


So not sure why I see two different happenings but I think they are the same issue.
 
Maybe this will help?!

Hammer_3.gif
 
Nope, needs a bigger hammer.

This one is above my pay grade. Raising a ticket on github.

The problem is, we're using ...

Code:
			Fabrik.addEvent('fabrik.form.submitted', function (form, json) {
				//fired when form submitted - enables element to update itself with any new submitted data
				if (this.options.popupform === form.id) {
					// rob previously we we doing appendInfo() but that didnt get the concat labels for the database join
					this.updateFromServer();
				}
			}.bind(this));

... in the join element's initialize(), which gets run when the onComplete() runs after submitting the form in the popup that adds the new option. So far so good. But the problem is, it's bound to 'this', which is the original element object.

When we clone a group, and the join element gets cloned ... the 'fabrik.form.submitted' event that runs is still bound to the original element. So when it runs this.updateFromServer(), it's running it for the original element, not the cloned element.

When using regular window events, we solve this issue by doing things like this:

Code:
			b.removeEvent('click', this.startEvent);
			b.addEvent('click', this.startEvent);

... when we clone the element. But that won't work for Fabrik.addEvent / removeEvent, as they aren't bound to an DOM object.

-- hugh
 
I love waking up to responses like this. It's like Christmas every day, getting to see how Uncle Rob fixed the issues I gave up on. :)

-- hugh
 
And although I spoke to him on Skype I did actually forget to update this thread due to another bug I discovered whilst testing... heh

So thank you to you both for the diagnostic, detailed explanation and fix! ;D


P.s I've kinda discovered something else... but I'll post over the weekend so it can wait until next week. ;)
 
OK. Did you test Rob's fix? I looked at the example page we were using for this, but it seems to have changed.

-- hugh
 
Yes it works fine and I uploaded to the demo server as well.

I changed the page today which is why it looks different, cleaned up the entries in case you were missing yours :)


The only other minor issues is the 'add in frontend' option.

Clicking on add brings out the popout form as expected, that works fine but only the first time you add an entry. Should once you've added an entry you wish to add another, the popout works as expected but the save doesn't work. The only work around is to close the popout, save the form, re-edit and then proceed to add another entry.

This happens in the backend so it's not template related or anything like that.


Another observation, the popout form has a 'go back' button, logically I would have thought that would simply close the popup and take you back to the main form but it actually works as a 'go back' for the main form taking you out of the main form alltogether.


Just minor issues both with workarounds so nothig urgent. :)
 
'add in frontend' option.

Clicking on add brings out the popout form as expected, that works fine but only the first time you add an entry. Should once you've added an entry you wish to add another, the popout works as expected but the save doesn't work. The only work around is to close the popout, save the form, re-edit and then proceed to add another entry.

This happens in the backend so it's not template related or anything like that.


Another observation, the popout form has a 'go back' button, logically I would have thought that would simply close the popup and take you back to the main form but it actually works as a 'go back' for the main form taking you out of the main form alltogether.


Forgot about this one until I started adding records again. ;)

<Bump>
 
Not included in my above text, this is a repeat element with a database join with the add in front end feature.

I should also add that I have tested this in the front end now with IE, Opera, Firefox and Chrome and they all produce the same problem with no error message.
 
Clicking on add brings out the popout form as expected, that works fine but only the first time you add an entry. Should once you've added an entry you wish to add another, the popout works as expected but the save doesn't work. The only work around is to close the popout, save the form, re-edit and then proceed to add another entry
Does your form have a fileupload element in it? Earlier today I fixed an issue which sounds like the one you are seeing when the popup form has a fileupload element
in it.
 
No it's doesn't have a file upload element.

Catch me on Skype if you want server access, it's a pretty basic setup but enough to bring this little project to a halt. :)
 
Initial tests show this to be working with the work Rob did in the last couple of hours.

Will test on another site and close the thread and github issue if everything is okay.


If you get notification of this thread Rackem maybe you could test as well.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top