kennym / cf7-to-api

LOOKING FOR MAINTAINER. Wordpress plugin to transmit contact form 7 entries to remote API using POST or GET
https://wordpress.org/plugins/cf7-to-api-basic-auth/
52 stars 30 forks source link

Handle API errors #21

Open jamescremona-highlight opened 4 years ago

jamescremona-highlight commented 4 years ago

Currently, if the form is filled up properly but an error occurs at the API side, the form still shows a 'success' message. Would be nice to be able to show the server error on the form if the API call fails.

chrisolesen commented 4 years ago

In the contactform setting under

Is this what you are looking for?

jamescremona-highlight commented 4 years ago

In the contactform setting under

  • DEBUG LOG ( View last transmission attempt ) - there is a field with "Remote server result:"

Is this what you are looking for?

No, what I was thinking is to show the user (on the front-end side) that an error occurred at the API side

As an example, if the API replies with a "500: internal server error", the form on Front End would show "Internal server error"

RafaelMiquelino commented 3 years ago

Hi @kennym, do you have any plans to address this issue? Your solution is perfect for my use case except for this detail. I'd love to contribute but PHP is not really amongst my prefered programming languages so I don't know even where to start.

RafaelMiquelino commented 3 years ago

Thanks!

MohammadShahdad commented 3 years ago

@RafaelMiquelino this will be in the next release.

Bump! Wondering if this was released?

mooksz commented 3 years ago

Great plugin, but sis this possible yet? Would really make the plugin more usefull in a lot of cases.

lpla commented 1 month ago

I implemented this workaround for the API error codes to be treated as CF7 errors, so that colors match the message type and form doesn't get wiped if API response had any error: https://github.com/kennym/cf7-to-api/pull/62