Comments (10)
use:
{% component 'forms::form1' %}
create the file under your theme: your-theme/partials/forms/form1.htm
it's not required to create that under your-theme directory, but it's more convenient because you can create directory with CMS partials feature.
from october-plugin-forms.
Hello @Zmove
After looking on October documentation and investigating the source, i can't find a way to rename default components html.
Do you know any alternative or a plugin doing this?
Thanks.-
from october-plugin-forms.
I don't know any plugins to do that (maybe it's not possible cause hardcoded in october core) but I made some progress.
I could customize the path and name of partial file for my form by using partials instead of components.
Instead of doing (lets assume my form have the contact alias)
{% component contact %}
I do
{% partial 'forms/contact.htm' __SELF__ = 'contact' %}
In my form.contact.htm partial, I have the same code than the genericForm/default.htm
I could remove the SELF = 'contact' variable defined in my partial and replace all the {{ SELF }} twig variables in the partial by {{ contact }} but I prefer to keep the default code in the partial (but that's just a personal preference).
I encountered 2 problems :
The first one (but can be fixed easily)
About the captcha, calling the partial {{ partial '@recaptcha' }} throw me an error cause october cannot find the partial, not sure what the @ prefix mean, but I replaced that code by {{ partial 'forms/recaptcha' SELF = 'contact' }} and I replaced the default component partial by mine. It works.
The second one (cannot be fixed actually without plugin update)
Second problem (more annoying) is about the success message. It's not flexible enought to magically put the result of the partial in a div with specific ID. It would be better to do something like this :
<div id="{{ forms }}_forms_flash">{% partial '@flash.htm' %}</div>
And, in the partial, to add a condition to output nothing if there is nothing to display. (In fact, even the wrapper div could be inside the flash partial to avoid empty div if there is no messages).
{% if flash %}
<div class="alert alert-{{ type }}">..........
{% endif %}
Like that, I could call my own partial for the flash message using the same way than the captcha, by replacing {% partial '@flash' %} by {% partial 'forms/flash' %}
This is the recommanded way to proceed to move default component markup to custom partial. markup). See documentation about it
from october-plugin-forms.
Another way to do use: overriding component's partial as described here
- Create directory in your theme's partial directory with the name of your form-component (note: if you alias your form, the directory name should be the alias, I am using 'service_request' as the alias for 'genericForm' so I should create partials/service_request directory under my theme directory))
- Create default.htm in that new directory (themes/my-theme/partials/service_request/default.htm)
That should do.
from october-plugin-forms.
Hello,
Thank you for the reply but it does bring answer to the initial problem.
By doing as you suggest, if you have 20 different form, you end with something like this :
form1/default.htm
form2/default.htm
form3/default.htm
form4/default.htm
It's a lot of different folder for the same feature provided by the same plugin ! When you have lots of form, it would be better to have something like this
forms/form1.htm
forms/form2.htm
forms/form3.htm
etc....
There is a solution to group all forms inside one folder as described in my previous post. It's not ideal but it works !
To improve that the solution would be to add en option in the component configuration to let the user choose the filename of the partial they want to use (instead of default.htm) but, by reading the author reply, it seems it's not possible actually with october cms, so I think the issue can be closed.
from october-plugin-forms.
Wow, I will test that and if it works, you are a genius !
from october-plugin-forms.
This worked for me.
I don't think the plugin needs any modifications because the solution it's at page level.
from october-plugin-forms.
I confirm, it's managed by october core, so it's not an issue related to this module. Could be closed.
from october-plugin-forms.
@gwugodevco @Alex360hd can you kindly explain how to implement this please?
I have created a file in my theme partials/forms/form1.htm, then I created a CMS page with the genericForm component.
I've aliased the component with 'form1' and on the page I call the component as suggested:
{% component 'forms::form1' %}
But this does not render the form on the page, I've tried aliasing the component as forms::form1 but this give a validation error.
Can you please let me know what I am missing?
Thanks.
from october-plugin-forms.
@skydiver can you have a look at my comment above and let me know how to do this please?
Thanks for your assistance.
from october-plugin-forms.
Related Issues (20)
- Plugin breaks in Build >1.0.469 HOT 5
- The specified file extension [js] is invalid HOT 2
- No buttons on component input fields HOT 5
- Translate fields name in backend
- Error 405 caused by field validation on live server
- Post AJAX not Working. HOT 1
- Bug HOT 2
- Image/file validation error HOT 2
- reCAPTCHA does not work HOT 1
- Error code 406 after validation
- proc_open() has been disabled for security reasons
- Sending the form with the October JavaScript API instead of Data attributes gives 406 Not Acceptable
- Expected response code 250 but got code 550 HOT 3
- File uploaded on the storage but not displayed in the record and email. HOT 1
- Laravel Validation HOT 13
- How to add auto response email field in generic forms? HOT 3
- DE translation mistake
- Using Magic Form on October CMS 3 HOT 2
- Currently Getting this Error when submitting my Ajax Upload Form HOT 1
- Magic Forms does not support October CMS v3 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from october-plugin-forms.