<p>If you don't want to build a custom plugin to do this you can easily add JavaScript to the control panel using the CP-JS plugin: <a href="https://plugins.craftcms.com/cp-js" rel="nofollow noreferrer">https://plugins.craftcms.com/cp-js</a></p>

CC BY-SA 4.0
2021-11-05T11:49:08.273Z
2021-11-05T11:49:08.273Z
James Smith
<p>When adding an entry, there is a field called resource id, I want to build a front end event on this field, after the value input or changed, trigger ajax to call an external api to check whether the resource id is existing.</p>
<p>I wonder if there is a way to do that, many thanks.</p>
<p><a href="https://i.sstatic.net/0Z5jB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0Z5jB.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2021-11-03T08:16:19.190Z
What do you mean by frontend event? A frontend form that updates the value of that field?
MoritzLost
CC BY-SA 4.0
2021-11-03T09:16:59.690Z
@MoritzLost such as onChange event. when the value changed, will trigger that event.
Thomas
<craft3><entries-field><frontend><entry-form>
How to bind JavaScript events to entry form fields in the control panel
# How to bind JavaScript events to entry form fields in the control panel

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

When adding an entry, there is a field called resource id, I want to build a front end event on this field, after the value input or changed, trigger ajax to call an external api to check whether the resource id is existing.

I wonder if there is a way to do that, many thanks.

[![enter image description here](https://i.sstatic.net/0Z5jB.png)](https://i.sstatic.net/0Z5jB.png)

**Tags:** craft3, entries-field, frontend, entry-form
> **Comments:**
> **username_1**: What do you mean by frontend event? A frontend form that updates the value of that field?  
> **username_0**: @MoritzLost such as onChange event. when the value changed, will trigger that event.  

---

## 1 answers

### Answer by username_2 on 2021-11-05. Score: 0 | Accepted answer

If you don't want to build a custom plugin to do this you can easily add JavaScript to the control panel using the CP-JS plugin: <https://plugins.craftcms.com/cp-js>


---

