<p>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 <a href="https://craftcms.com/docs/3.x/routing.html" rel="nofollow noreferrer">custom route</a> for it. See the <a href="https://github.com/xpertbot/craft-wheelform/blob/master/README.md" rel="nofollow noreferrer">Wheel Form plugin documentation</a> for details.</p>
<p>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.</p>
<hr />
<h3>Update addressing the comments</h3>
<p>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 <a href="https://github.com/xpertbot/craft-wheelform/blob/master/README.md#template-variables" rel="nofollow noreferrer">template variables</a> in your API and then replicate the <a href="https://github.com/xpertbot/craft-wheelform/blob/master/README.md#template-structure" rel="nofollow noreferrer">advanced template</a> in your React templates. The submit the form to the <a href="https://github.com/xpertbot/craft-wheelform/blob/master/src/controllers/FormController.php" rel="nofollow noreferrer">FormController</a> of the Wheel Form plugin manually.</p>
<p>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 <a href="https://craftcms.com/docs/3.x/extend/controllers.html" rel="nofollow noreferrer">custom Controller</a> and write your form natively in React?</p>

CC BY-SA 4.0
2021-11-25T06:17:43.193Z
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
Santanu Adak
CC BY-SA 4.0
2021-11-25T08:57:12.333Z
@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
CC BY-SA 4.0
2021-11-25T15:18:31.693Z
How do I save Wheelform data to the database using PHP code?
Santanu Adak
CC BY-SA 4.0
2021-11-25T15:35:18.910Z
@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](https://github.com/xpertbot/craft-wheelform/tree/master/src/services) directly, though I'm still not sure what you're trying to do there.
MoritzLost
CC BY-SA 4.0
2021-11-23T09:23:18.947Z
2021-11-25T08:56:30.203Z
2021-11-25T08:56:30.203Z
MoritzLost
<p>I've installed a &quot;wheel form&quot; plugin on headless CMS.
<a href="https://i.sstatic.net/ixR6A.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ixR6A.png" alt="enter image description here" /></a></p>
<p><a href="https://i.sstatic.net/Ufbbn.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Ufbbn.png" alt="enter image description here" /></a>
Now how do I make this form JSON format using API or write PHP code for display on the frontend?</p>

<craft3>
How to make "Wheel Form" fields in JSON format using API
# How to make "Wheel Form" fields in JSON format using API

(Asked by: username_0 on 2021-11-22)

I've installed a "wheel form" plugin on headless CMS.
[![enter image description here](https://i.sstatic.net/ixR6A.png)](https://i.sstatic.net/ixR6A.png)

[![enter image description here](https://i.sstatic.net/Ufbbn.png)](https://i.sstatic.net/Ufbbn.png)
Now how do I make this form JSON format using API or write PHP code for display on the frontend?

**Tags:** craft3


---

## 1 answers

### Answer by username_1 on 2021-11-23. Score: 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](https://craftcms.com/docs/3.x/routing.html) for it. See the [Wheel Form plugin documentation](https://github.com/xpertbot/craft-wheelform/blob/master/README.md) 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](https://github.com/xpertbot/craft-wheelform/blob/master/README.md#template-variables) in your API and then replicate the [advanced template](https://github.com/xpertbot/craft-wheelform/blob/master/README.md#template-structure) in your React templates. The submit the form to the [FormController](https://github.com/xpertbot/craft-wheelform/blob/master/src/controllers/FormController.php) 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](https://craftcms.com/docs/3.x/extend/controllers.html) and write your form natively in React?

> **Comments:**
> **username_0**: 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  
> **username_1**: @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.  
> **username_0**: How do I save Wheelform data to the database using PHP code?  
> **username_1**: @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](https://github.com/xpertbot/craft-wheelform/tree/master/src/services) directly, though I'm still not sure what you're trying to do there.  

---

