Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Custom contact form as php post script in Grav

form

Solved by pamtbaau View solution

Started by joh 6 years ago · 5 replies · 709 views
6 years ago

Hello there,

I am trying to bring a custom-made contact form to graph. It is made in PHP:
it gets the data from the UI-form via post then fires off either errors or an email and a success message. Pretty plain.

🤔 Is there a way to make this run in/next to graph?
🤓 I tried to just drop it in a folder. I get a 403 (Forbidden)
🤯 Tried to do it as a plugin and found out: I don't know how.

Can someone help me with a hint?
TKS

6 years ago Solution

@joh, Did you have a look at Grav's frontend forms?

If so, would you mind sharing which aspect of the custom-made contact form cannot be implemented by Grav's forms?

6 years ago

@pamtbaau Oeps, maybe I should. Thanks! Will be back soon after checking this.

last edited 06/24/20 by pamtbaau
6 years ago

@pamtbaau I am struggeling. My markup of that form is quite unique. I cannot do in the frontmatter code since it does not allow to du custom divs and stuff. :-/

6 years ago

@joh, That's a pity...

There are a few options:

  • There are common field attributes that can be added to each field, eg. to add 'classes' and 'outerclasses' with which you might fix a few things.

  • An other option is to override a form template. You can copy a Twig file from the form plugin (/user/plugins/form/templates/...) into you own theme (/user/themes/mytheme/templates/forms/...) and design your own layout.

    Theme Quark has overridden a few fields that way.

  • Wrap your custom form in a plugin. See tutorial and try again ;-).

  • Maybe someone on the forum can help you out if you don't mind sharing the layout you require using pseudocode.

👍 1
last edited 06/24/20 by pamtbaau
6 years ago

@pamtbaau: thank you a lot for making that list.

Maybe someone looks for a similar thing. So I quickly talk about my solution:
In the end it became a version with the initially suggested frontend forms. I paired it with a custom JS that does the frontend validation.

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 49 1 week ago
Plugins · by Xavier, 4 weeks ago
2 57 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1184 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 50 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 75 2 months ago