ampproject / ampproject/amphtml

amp-form: always trigger page reload on submit on mobile

Open
#33,624 10 comments 0 reactions 1 assignee Claimed by @micajuine-ho View on GitHub
Component: amp-form Stale Type: Bug WG: components
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

## What's the issue?

**amp-form submit always trigger page reload on mobile browsers**

I have a form which displays something depending on the response from server.
Success response would also display the results of query.
Error response would display errors and dynamically change css styles to emphasize elements.

Code works as expected on desktop.
However in mobile, it always trigger page reload/refresh on submit and would not display elements inside `

` and `
`.

Is there any way to prevent this behavior or make it in such a way it behaves like event.preventDefault() on non-amp pages?
If no, then is the "AMP way" of submitting forms on mobile devices always need to reload/redirect to another page?

## How do we reproduce the issue?
```


Success



SError


```

## What browsers are affected?
Only mobile browsers.
Tested on:
- Safari 14.4.2 mobile
- Chrome 87.0.4280

## Which AMP version is affected?
Version 2103240330002

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.