Git Product home page Git Product logo

Comments (5)

flaviocopes avatar flaviocopes commented on June 30, 2024

@rhukster in your opinion should page.route include the lang code? Or should uri.rootUrl? Or should we add a separate method to Uri that returns the root url including the lang?

from grav-plugin-form.

nsierram avatar nsierram commented on June 30, 2024

Just for those in this situation, it's possible to avoid the 404 setting the form.action value in the YAML frontmatter of the page as the name of the route.
For example my form is in
mysite.local/en/contact (where en is the language code).
So for the file that renders the above route (i.e. form.en.md) add the value form.action: contact
For example for italian translation my route is
mysite.local/it/contatti as I have set the slug as contatti, so set form.action: contatti
And so on.

from grav-plugin-form.

rhukster avatar rhukster commented on June 30, 2024

page.route() should definitely not have the lang code forced.

Better option would be to use page.url() as this will prefix with the lang code. Can someone test that?

from grav-plugin-form.

rhukster avatar rhukster commented on June 30, 2024

So how about changing the action line in the plugins/form/templates/forms/default/form.html.twig file to:

action="{{ form.action ? base_url ~ form.action : page.url }}"

This way the base_url will have lang code if required also.

from grav-plugin-form.

bovisp avatar bovisp commented on June 30, 2024

@rhukster . This seems to have solved my problem as I outlined it in Gitter earlier today.

from grav-plugin-form.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.