<p>The only way to do this is asynchronously with javascript. If you already have an interactive event on the page I'm guessing you are using JS already? If so you just need to submit a hidden <a href="https://docs.craftcms.com/v3/dev/examples/entry-form.html" rel="nofollow noreferrer">front end form</a> alongside <a href="https://craftcms.com/guides/enabling-csrf-protection#updating-your-javascript" rel="nofollow noreferrer">the CSRF token</a>.</p>

CC BY-SA 4.0
2019-10-22T20:47:25.420Z
cool! thank you.  I figured that was the only way but started 2nd guessing ... will do the form method for now and then build a plugin later.  thanks for answering.
Erant
CC BY-SA 4.0
2019-10-22T14:22:18.830Z
2019-10-23T08:35:56.863Z
2019-10-23T08:35:56.863Z
dmatthams
<p>I need to create an entry from my UI after the user triggers a particular event on the page.</p>

<p>I want this to happen automatically and not rely on the user to submit a form.</p>

<p>Is there a way to create an Entry from a twig template (i.e. by calling the required controller function)?  If not, is there an existing plugin that could work?</p>

<p>My content structure is something like this:</p>

<pre><code>mySection = name of Channel that the entires will belong to.  Has the following fields:

myField1 = number 
myField2 = text 
myField3 = number
user = craft user field (relates the entry to an appropriate user)
</code></pre>

<p>I was hoping I could set those variable and call some sort of submit/save function to create the new Entry.</p>

<entries>
Create entry from template / UI without a form
# Create entry from template / UI without a form

(Asked by: username_0 on 2019-10-21)

I need to create an entry from my UI after the user triggers a particular event on the page.
I want this to happen automatically and not rely on the user to submit a form.
Is there a way to create an Entry from a twig template (i.e. by calling the required controller function)?  If not, is there an existing plugin that could work?
My content structure is something like this:
mySection = name of Channel that the entires will belong to.  Has the following fields:

myField1 = number 
myField2 = text 
myField3 = number
user = craft user field (relates the entry to an appropriate user)

I was hoping I could set those variable and call some sort of submit/save function to create the new Entry.

**Tags:** entries


---

## 1 answers

### Answer by username_1 on 2019-10-22. Score: 1 | Accepted answer

The only way to do this is asynchronously with javascript. If you already have an interactive event on the page I'm guessing you are using JS already? If so you just need to submit a hidden [front end form](https://docs.craftcms.com/v3/dev/examples/entry-form.html) alongside [the CSRF token](https://craftcms.com/guides/enabling-csrf-protection#updating-your-javascript).

> **Comments:**
> **username_0**: cool! thank you.  I figured that was the only way but started 2nd guessing ... will do the form method for now and then build a plugin later.  thanks for answering.  

---

