1

I've installed a "wheel form" plugin on headless CMS. enter image description here

enter image description here Now how do I make this form JSON format using API or write PHP code for display on the frontend?

1

You need to write a Twig template for the form and add it somewhere on your site. You can either add the form to an existing page or add a custom route for it. See the Wheel Form plugin documentation for details.

You question is very broad and can't be answered in more detail without knowing more. Try to follow the setup instructions in the documentation, and post a more specific question if you get stuck on any step in particular.


Update addressing the comments

If you're running Craft as a headless CMS, the Wheel Form plugin is not a good fit. The plugin is specifically designed to be able to create forms in the backend without that are displayed with a unified template so new forms can be created without writing a new template. This requires Twig by design. If you wanted to utilize the plugin for a headless CMS + React setup, you'd have to figure out how to put all the template variables in your API and then replicate the advanced template in your React templates. The submit the form to the FormController of the Wheel Form plugin manually.

It's possible, sure. But at that point, how much effort are you spending to make the plugin do something that it wasn't designed to do? How much easier would it be to just write a custom Controller and write your form natively in React?

4
  • I can't add this form to the Twig file, set the route and display it on the frontend because I'm using Headless CMS. Actually, I made the frontend with React and controlled the backend with Craftcms. So I can't pass any code of the Twig file with API, And I can't understand how to load view or twig file in headless cms controller. If anyone knows please help me Nov 25 at 6:17
  • @SantanuAdak If you're running a headless CMS, a form builder plugin is not a good solution to your problem. I've updated my answer to explain why, and how you could solve this anyway if you really want to.
    – MoritzLost
    Nov 25 at 8:57
  • How do I save Wheelform data to the database using PHP code? Nov 25 at 15:18
  • @SantanuAdak I'm not sure what that even means. You can send your form to the Wheelform controller (see the link above for details), then it will be processed normally. If you need some kind of custom controller, you can also talk to the Wheelform services directly, though I'm still not sure what you're trying to do there.
    – MoritzLost
    Nov 25 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.