-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve route-based selection when multiple partial forms have the same slug #309
Conversation
f184330
to
bfa102e
Compare
ping |
I ran into the same issue when I was redoing the form plugin. Because of that, I have actually made some improvements for this in Form 3.0 (in the testing channel), making it to check the current page first and to include forms from modular content in the modular page. Can you test it out? |
I believe you're referring to 1f07211 and d2d2130 |
then get its name, and then fetch form by name. Not only is this suboptimal but create a bug when two forms share the same name. Eg: a form is used as part of a modular page and dynamically included in the template by its name. If another modular page exists, containing a page with an identical form slug, then this will fail. => In case route is requested and form exists: just return it inmediatly getgrav#309
then get its name, and then fetch form by name. Not only is this suboptimal but create a bug when two forms share the same name. Eg: a form is used as part of a modular page and dynamically included in the template by its name. If another modular page exists, containing a page with an identical form slug, then this will fail. => In case route is requested and form exists: just return it inmediatly getgrav#309
bfa102e
to
3cf7bd2
Compare
I installed Grav 1.6 and tried forms 3.0 : it does not make it. |
OK, I took a deeper look into the logic to fetch the form and I don't think your fix is enough to solve the whole issue. The logic is written to find forms from the global namespace and not from individual pages. I don't think its correct -- forms in the current page should always take precedence and only if there aren't any forms, should it look for other pages. @rhukster Changing this behaviour may radically change which forms get selected, but right now the logic makes many advanced uses of the forms impossible. Prioritizing the current page would make Flex logic much simpler, for example, because of I could get rid of some of the custom logic in there. |
@mahagr I completely agree that form selection should be made much more clear. |
I'll discuss with @rhukster on this. We need to be sure we're not breaking anything that's not broken. |
then get its name, and then fetch form by name. Not only is this suboptimal but create a bug when two forms share the same name. Eg: a form is used as part of a modular page and dynamically included in the template by its name. If another modular page exists, containing a page with an identical form slug, then this will fail. => In case route is requested and form exists: just return it inmediatly getgrav#309
?! |
I fear I've to repeat once more.
I think that unless someone proves that the existing line-code serves a real purpose and fixes a bug, the buggy-line must be removed. |
I believe the issue was closed because of the branch does not exist anymore. @drzraf Please do the change against develop |
then get its name, and then fetch form by name. Not only is this suboptimal but create a bug when two forms share the same name. Eg: a form is used as part of a modular page and dynamically included in the template by its name. If another modular page exists, containing a page with an identical form slug, then this will fail. => In case route is requested and form exists: just return it inmediatly getgrav#309
then get its name, and then fetch form by name. Not only is this suboptimal but create a bug when two forms share the same name. Eg: a form is used as part of a modular page and dynamically included in the template by its name. If another modular page exists, containing a page with an identical form slug, then this will fail. => In case route is requested and form exists: just return it inmediatly getgrav#309
…mine/form-attr-improvments Squashed commit of the following: commit 5f9fcae Author: Raphaël Droz <raphael.droz+floss@gmail.com> Date: Tue Feb 19 19:43:24 2019 -0300 When a form is requested by route, the routine extract the matching one then get its name, and then fetch form by name. Not only is this suboptimal but create a bug when two forms share the same name. Eg: a form is used as part of a modular page and dynamically included in the template by its name. If another modular page exists, containing a page with an identical form slug, then this will fail. => In case route is requested and form exists: just return it inmediatly getgrav#309 commit aac0df0 Author: Raphaël Droz <raphael.droz+floss@gmail.com> Date: Thu Dec 20 12:02:30 2018 -0300 Show the `description` span even for an empty description because this field, even if empty at initial page load may be used and changed by javascript listeners. commit d83422d Author: Raphaël Droz <raphael.droz+floss@gmail.com> Date: Fri Nov 16 10:38:53 2018 -0300 allow form scope to be set from form parameters allow data-* form parameters to be used as <form> attributes (blueprints-expansion enabled)
…ne (#338) then get its name, and then fetch form by name. Not only is this suboptimal but create a bug when two forms share the same name. Eg: a form is used as part of a modular page and dynamically included in the template by its name. If another modular page exists, containing a page with an identical form slug, then this will fail. => In case route is requested and form exists: just return it inmediatly #309
…mine/form-attr-improvments Squashed commit of the following: commit 5f9fcae Author: Raphaël Droz <raphael.droz+floss@gmail.com> Date: Tue Feb 19 19:43:24 2019 -0300 When a form is requested by route, the routine extract the matching one then get its name, and then fetch form by name. Not only is this suboptimal but create a bug when two forms share the same name. Eg: a form is used as part of a modular page and dynamically included in the template by its name. If another modular page exists, containing a page with an identical form slug, then this will fail. => In case route is requested and form exists: just return it inmediatly getgrav#309 commit aac0df0 Author: Raphaël Droz <raphael.droz+floss@gmail.com> Date: Thu Dec 20 12:02:30 2018 -0300 Show the `description` span even for an empty description because this field, even if empty at initial page load may be used and changed by javascript listeners. commit d83422d Author: Raphaël Droz <raphael.droz+floss@gmail.com> Date: Fri Nov 16 10:38:53 2018 -0300 allow form scope to be set from form parameters allow data-* form parameters to be used as <form> attributes (blueprints-expansion enabled)
When a form is requested by route, the routine extract the matching one then get its name, and then fetch form by name.
Not only is this sub-optimal but create a bug when two forms share the same name.
Eg: a form is used as part of a modular page and dynamically included in the template by its name. If another modular page exists, containing a page with an identical form slug, then this will fail.
=> In case a route is requested and form exists: just return it immediately.