Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-05T11:49:08.273Z
Answers.LastActivityDate: 2021-11-05T11:49:08.273Z
Answers.UserDisplayName: James Smith
Body: <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>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-11-03T08:16:19.190Z
Comments.Text: What do you mean by frontend event? A frontend form that updates the value of that field?
Comments.UserDisplayName: MoritzLost
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-11-03T09:16:59.690Z
Comments.Text: @MoritzLost such as onChange event. when the value changed, will trigger that event.
Comments.UserDisplayName: Thomas
Tags: <craft3><entries-field><frontend><entry-form>
Title: How to bind JavaScript events to entry form fields in the control panel
ThreadText: # 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**: @username_1 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>
  
  
  ---
  
  