Kdyby / FormsReplicator

Other
30 stars 58 forks source link

Adding and removing stops onSuccess event #22

Closed vojtech-dobes closed 10 years ago

vojtech-dobes commented 10 years ago

I usually add redirect after form submit into onSuccess[] event. But when you click button with addCreateOnClick or addRemoveOnClick, you probably never want any final processing of the form. This would also remove requirement to attach final processing to onClick event of primary send button.

fprochazka commented 10 years ago

Well, yes. But I was afraid to clear the callback. It makes sense but I'm still not sure if the click callback should be doing it.

vojtech-dobes commented 10 years ago

You mean whether be so drastic, or just whether it should be in this place? I guess that as same as adding error expects onSuccess to stop, adding another dynamic container (for filling values) expects it too. onSuccess means end of the form. Adding another few empty fields is not success :).

fprochazka commented 10 years ago

That's why I'm always advising people to use only onClicks when you have at least one on form.

vojtech-dobes commented 10 years ago

I know, but onClick event is primarily for distinction of buttons (which all after adding have no function). But replicator's special buttons have function. I think this would make things simplier (and prevent people from being surprised why redirect occurs when it should not) without any real harm (nobody wants to process form on adding another container - if he does, he can attach this function to proper onClick rather :).

JakubJarabica commented 10 years ago

Like it!

fprochazka commented 10 years ago

Ok, let's try it :)

fprochazka commented 10 years ago

Thanks for the pull!

JakubJarabica commented 10 years ago

:+1: