Is it possible to create entries using javascript only?

Labels

This Discussion is public

Notifications

Hi,

I am having a problem which is to create an entry for a specific formidable form on my site using pure javascript.

Let's say I have a form with ID 2.

What I want to achieve is:

  • using the endpoint /wp-json/frm/v2/forms/2/fields to get an array of form fields
  • to build the form with a javascript framework, I am using Vue.js in this case.
  • post the data to /wp-json/frm/v2/forms/2/entries

The post action returns a 403 forbidden error.

I installed FF Pro and FF API two plugins.

I read a tutorial about sending API data to another form, the reason that tutorial is not applicable to my case is it only sends data to elsewhere after the entry in the original site is created.

Any suggestion is appreciated.

Cheers

 

I am just a community member, so I couldn't say more than this, but I am happy to refer you to the Ajax section of the documentation in hopes that you can find your answers there:
https://formidableforms.com/knowledgebase/general-form-settings/#kb-ajax

And if you want official support, and have a current Formidable Forms Pro account, you can open a ticket for support there: https://formidableforms.com/support/

Hi Dan,
Adrian is referring to Formidable API add-on - https://formidableforms.com/knowledgebase/formidable-api/

Hi Adrian,
Yes, it is possible. I used Python to create entries. JS would be the same. Just make sure, your payload has form_id and key-value pairs of field key and its value.
Since you are getting 403 error, it is mostly due to missing/wrong API key or basic auth is not enabled in your server https://formidableforms.com/knowledgebase/formidable-api/#kb-basic-authentication

My suggestion is to first send an API request from tools like postman. If it works then, translate it to JS code

Reply to this Discussion