I have multiple forms on the same page and when submitting all success divs is triggered. Is it possible to only show it for the form being submitted..?
If so, I can imagine the scenario you explain happening if you are sharing the same JavaScript status variable amongst all of your forms:
One way to avoid that would be to create an Angular directive that shows the status (i.e., unsubmitted, success, failure). By wrapping all that up in a directive, you can isolate the Angular $scope, which will ensure your status variables only affect one form at a time.
Let me know if you need any tips on how to do that.
Sure thing. I'll work on an alternative version of that page that shows how to make use of an Angular directive. In the meantime, if you've deviated from the instructions, would be useful to know so I can be sure to answer in the most appropriate way possible.
FYI, I just released Formulate 1.2.5, which contains a change for the propagation of events, which I believe will fix your issue (i.e., only one success message will appear when you submit a form on a page with multiple forms).
but the second form does not appear
is that something more that i have to change ?
let me tell you that im rendering this in a macro.
That is why i have the variable "sFormName" to avoid clashing with ohter instances of the same macro
I don't see why you are doing angular.module("app@(sFormName)"). I would think that would cause problems, as I would think you only have one AngularJS app on the page (at least, you should). Similarly, you should only have one ng-app="app" on the page (typically, on the body tag).
Also, I don't think you need to define your AngularJS controller in your macro (i.e., you should only need one per page).
Multiple forms
Noob-question:
I have multiple forms on the same page and when submitting all success divs is triggered. Is it possible to only show it for the form being submitted..?
I am assuming you are rendering your forms using some variation of this approach: http://www.formulate.rocks/render-form
If so, I can imagine the scenario you explain happening if you are sharing the same JavaScript
status
variable amongst all of your forms:One way to avoid that would be to create an Angular directive that shows the status (i.e., unsubmitted, success, failure). By wrapping all that up in a directive, you can isolate the Angular
$scope
, which will ensure your status variables only affect one form at a time.Let me know if you need any tips on how to do that.
As Im a total beginner in Angular I feel out on deep water here :) I would be grateful for some example code!
Sure thing. I'll work on an alternative version of that page that shows how to make use of an Angular directive. In the meantime, if you've deviated from the instructions, would be useful to know so I can be sure to answer in the most appropriate way possible.
Here are the instructions I'm talking about: http://www.formulate.rocks/render-form
Thanks!
I used the exact same code as you so Im trying to not mess anything up :)
After looking into this a bit, I think it was simply a bug in Formulate that was broadcasting the form submission status event too broadly (causing it to be picked up by all forms on the page). I think I have it fixed in this commit: https://github.com/rhythmagency/formulate/commit/13cfd73a5b051362327031dcb822b3bdaa3b5a93
I'm going to run it by a coworker tomorrow before I create a release with this fix.
Super! Thanks for fast support!
FYI, I just released Formulate 1.2.5, which contains a change for the propagation of events, which I believe will fix your issue (i.e., only one success message will appear when you submit a form on a page with multiple forms).
Let me know if that works for you.
Work perfect! Thank you!
Hello Nicholas im having problems rendering my second form on hte same page (forms are inside bootstrap tabs) it does not show :(
this is what im doing :
but the second form does not appear is that something more that i have to change ?
let me tell you that im rendering this in a macro. That is why i have the variable "sFormName" to avoid clashing with ohter instances of the same macro
thank you
Angelo
Hi Angelo,
I don't see why you are doing
angular.module("app@(sFormName)")
. I would think that would cause problems, as I would think you only have one AngularJS app on the page (at least, you should). Similarly, you should only have oneng-app="app"
on the page (typically, on the body tag).Also, I don't think you need to define your AngularJS controller in your macro (i.e., you should only need one per page).
It may help to refer again to this page, which shows some example markup/JavaScript: http://www.formulate.rocks/render-form
mmmm ok ... the problem can be the fact that im enstaciating this macro twice with the same JS
let me try with only one call to the angular js
thank you once again
Angelo
is working on a reply...