question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

amp-form: Submit Form on Input Change

See original GitHub issue

Currently forms require a separate submit button, would be great if it’d be possible to omit the submit button if the form contains a single checkbox. Each click on the checkbox would then trigger an XHR request.

This would enable implementing favorite/bookmark actions directly in AMPs with amp-form.

Example:

  <form method="post" action-xhr="https://example.com/bookmark/12345" action="https://example.com/bookmark/12345" target="_top">   
    <input type="checkbox" id="favorite" checked>
  </form>

//cc @mkhatib

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
fletc3hercommented, Aug 17, 2016

I have a navigation control which is implemented as a select within a form. When the select is changed I use jQuery to submit the form. If I could add on=“change:myform.submit” to the select then I could use this same navigation control on my AMP pages.

2reactions
dvoytenkocommented, Aug 1, 2016

What do we think about on="change:form.submit" action?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation: <amp-form> - amp.dev
Allows you to create forms to submit input fields in an AMP document. ... for example, tapping a link, or submitting a form...
Read more >
amp html - How to change input submit text value when ...
1 Answer 1 · Use amp-bind and bind the value of your button to a state. Add some start state: <amp-state id="formText"> <script...
Read more >
amp-form extended examples and tricks - amp templates
- The form elements which are considered valid and therefore – allowed by AMP validation are <input type=submit>, <input type=text>, <label>, <textarea>, < ......
Read more >
How to develop & implement AMP forms on AMP pages
Creating your AMP form HTML ... This part is very similar to a normal form but, instead of having an action attribute, we...
Read more >
amp-form - Gitee
Allows you to trigger the form submission on a specific action, for example, tapping a link, or submitting a form on input change....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found