tlovett1 / custom-contact-forms

Build beautiful custom forms and manage submissions the WordPress way.
https://taylorlovett.com
163 stars 50 forks source link

The form not work with wp api v2 #274

Open jairgarcia opened 8 years ago

jairgarcia commented 8 years ago

How make work with wp api v2.

Thanks.

michaelnagy commented 8 years ago

+1

michaelnagy commented 8 years ago

I can't find any documentation on how to use it with WP-API, howhever the plugin is listed in the Official WP-API list of compatible plugins.

tlovett1 commented 8 years ago

I've used with V2 of the API. In fact the plugin bundles it. What errors are happening exactly?

beatelite commented 8 years ago

Is there any documentation to use this with the API?

I'd love to create and manage forms using an endpoint. Hope that's what is possible here.

jairgarcia commented 8 years ago

@tlovett1 I don't add a new form in wordpress, see the follow link: http://prntscr.com/buvnm7

I use AngularJs with WP-API v2, any ideas?

Thanks

beatelite commented 8 years ago

@jairgarcia I use angular and wp api as well. Let me know if you figure it out as I'm going to dig into this next week. If I find anything out, I'll let you know as well.

pabloacastillo commented 8 years ago

When i disable the WP-API v2 the forms work again, this is the error i get from the Chrome Console: Uncaught TypeError: Cannot read property 'raw' of undefined source:http://xxxxxxxxxxxxxx/wp-admin/post.php?post=3633&action=edit line:6

pabloacastillo commented 8 years ago

Ok, after more testing i found that the form is trying to do fetch two urls:

a) Fetch the forms from: http://xxxxxxxxx/wp-json/ccf/v1/forms/?pages=1

b) Try to fetch the form from: http://xxxxxxxxx/wp-json/wp/v2/posts/3634

This last one fails since 3634 its not a post, its a ccf form so it fails to load with. { code: "rest_post_invalid_id", message: "Invalid post id.", data: { status: 404 } }

To test things out, i disabled all my plugins and left only the "custom-contact-form" active and everything works, when i enable the "WP REST API" plugin it fails again.

Im using Custom Contact Forms v7.8.3 and WP REST API v2.0-beta13.1 on Wordpress v4.6

Thanks!

pabloacastillo commented 8 years ago

To force things, i changed the post type of 3364 from ccf_form to post. The http://xxxxxxxxx/wp-json/wp/v2/posts/3634 stops failing and now the chrome console replies with: Uncaught TypeError: e.author.toJSON is not a function source:http://xxxxxxxxx/wp-content/plugins/custom-contact-forms/assets/build/js/form-manager.min.js?ver=7.8.3 line:1

pabloacastillo commented 8 years ago

Ok, i did a rollback from WP REST API v2.0-beta13.1 to WP REST API v2.0-beta10 and everything works again.

WP Rollback is a great tool :)

dellabravo commented 8 years ago

+1 Not working with WP REST API Version 2.0-beta13.1

brianstateside commented 8 years ago

temporal solution: I did change WP REST API Version 2.0 from beta 13.1 to beta 10. to get the CCF working. looks like CCF is not adding support for the current WP rest api v2. beta10 works.