phpformsamp-htmlgoogle-amp

AMP Form - submit-success message not displaying, but error displays fine


I've created a simple amp-form, using php to send results by email. The form works, including the submit-error message, which displays properly. However, on successful submit, the submit-success message never displays. I'm completely puzzled.

Here's a snippet of my code, modeled exactly on the AMP By Example examples:

<div><button type="submit" class="form-button-class">send</button></div>
<div submit-success><template type="amp-mustache">Success! Thanks for your message.</template></div>
<div submit-error><template type="amp-mustache">There was a problem sending your message.</template></div>
</form>

Additional note: the submit button grays out on submit, but refuses to hide, when I use the proper CSS (also from AMP documentation) -- maybe this is related? For now, I removed the css for cleaner testing.

Any ideas as to what might be causing this? Could it be on the php handling end? Thanks!


Solution

  • For anyone interested or facing the same behavior: in my case, this was a json scripting issue. No idea why error processing works just fine, but json caused success actions not to happen after successful submit. Fixing this allowed submit-success message to display properly.