Amphtml: Make Dynamic action-xhr in amp-form

Created on 8 Sep 2017  路  12Comments  路  Source: ampproject/amphtml

It would be really good if we can bind action-xhr in the amp-form.

Scenario:

Got two forms: Contact Form and OTP (intial hidden)
Contact form successful submission sends some dynamic response (using amp-bind preserve the response state) which is used to create OTP form url.

Let me know what you think of this?

amp-form Developer Soon DevX Feature Request components

All 12 comments

/to @cvializ
/cc @choumx @ericlindley-g

Shouldn't be too difficult to enable with bind. We already allow amp-list URLs to be bound with [src].

Update? 10 months

This isn't currently on the mid-term roadmap. Would be useful for our prioritization to hear any business impact that might not be obvious to us. Thanks!

Gotcha - thanks.
Our app (https://shopsheriff.com/amp) converts Shopify stores into AMP pages. The "Add to Cart" button submits a GET request to a specific Shopify store URL in order to perform that adding-to-cart functionality. There are some other functionality that may take place such as skipping the cart, and these require different URLs to be submitted. That _was_ my use case. Fortunately I've found a way around this by using a different method, so I'm not currently in need of it, but that was a pretty decent use-case, because I had to interact with form functionality and url structures that were pre-determined.

Thanks for sharing! Good to know the concrete need here

Another workaround is to use multiple forms and buttons.

This issue hasn't been updated in awhile. @cvializ Do you have any updates?

i'm getting the user info using xhr with amp-state and trying to send the userToken in action-xhr but i can't put the value dynamicaly with amp-bind, how can i proceed?

I'm using the Load More button in a form in order to grab the next page of results and update the listing. This works by itself. When filtering, the action-xhr will need to change to reflect the user's selection. So currently the next page will be the unfiltered dataset.

I was able to overcome this by using another amp-list element, and setState on a tap: event.

I'm using the Load More button in a form in order to grab the next page of results and update the listing. This works by itself. When filtering, the action-xhr will need to change to reflect the user's selection. So currently the next page will be the unfiltered dataset.

I was able to overcome this by using another amp-list element, and setState on a tap: event.

Hello,
Can You send sample code in AMP for Load more?

I just want to add here, a big weak point with AMP for me are these "workarounds" which inevitably creates unnecessary clutter and makes things hard to follow and maintain overtime.

Was this page helpful?
0 / 5 - 0 ratings