To hide the submission form after a submission, you can use the “site-reviews/after/submission” custom Javascript event, for example:
document.addEventListener( 'site-reviews/after/submission', function( event ) {
if( event.detail.errors !== false )return;
// The review has been submitted successfully so you can now
// manually hide the submission form and show the success message.
});
The important property in the event
variable in this custom event is the event.detail
property. This object contains the following properties:
event.detail.errors
= This contains any form errors that were passed. You must check that this is false (event.detail.errors === false
) before any redirection or “on success” logic takes place.
event.detail.message
= This contains either the success message or the error message for the form.
event.detail.form
= This contains the HTMLFormElement of the review submission form. If you want to hide the form after submission, you can use this as the target.
You can either use jQuery to animate removing the form jQuery(event.detail.form).slideUp().parent().append('<p>' + event.detail.message + '</p>'); // something like that
, or see here for tips on using vanilla JS: https://plainjs.com/javascript/effects/animate-an-element-property-44/
-
This reply was modified 7 years, 8 months ago by
Gemini Labs.
-
This reply was modified 7 years, 8 months ago by
Gemini Labs.
-
This reply was modified 7 years, 8 months ago by
Gemini Labs.