Amphtml: amp-form: Support auto formatting

Created on 16 Nov 2017  Â·  21Comments  Â·  Source: ampproject/amphtml

Many form inputs use JS to auto format fields such as dates, credit card numbers and phone numbers as user types (e.g. auto insert separators, stop accepting input after x charters, etc..)

For a few examples see jQuery Mask Plugin: https://igorescobar.github.io/jQuery-Mask-Plugin/

We should support such use-cases in AMP, if we somehow manage to make it super generic and use the RegEx specified in validation's "pattern" (with an explicit opt-in) that would be awesome, otherwise a decent subset of common cases ( essentially the ones supported by the jQuery plugin) would be a good start.

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

High Priority Feature Request

All 21 comments

This has been on my mind too, I think it is a great idea to prioritize this for e-commerce.

@lswang1618 was interested in this for credit card fields in amp-payment IIRC. /cc @cathyxz

+1! this was the library I looked at: https://github.com/RobinHerbots/Inputmask

it has some cool options like dynamically changing the masking w/ user input (i.e. changing a credit card pattern as the user types)

This is a high priority issue but it hasn't been updated in awhile. @cvializ Do you have any updates?

I think the subset of use cases we want to support are

  • Date
  • Telephone
  • Credit Card number
  • Money amount
  • Zip code
  • Time

But I don't actually think full regex support is necessary for most use cases. All we really need is

  • Shorthand definitions for numbers, letter, and numbers + letters (i.e. https://screenshot.googleplex.com/k4YsZ9tV7oR)
  • Recursive and optional flags (i.e. https://igorescobar.github.io/jQuery-Mask-Plugin/docs.html#translation)
  • A placeholder attribute (i.e. {placeholder: __/__/____)}

This should be enough to support the major use cases. Thoughts?

This is a high priority issue but it hasn't been updated in awhile. @cvializ Do you have any updates?

This is a high priority issue but it hasn't been updated in awhile. @cvializ Do you have any updates?

This is a high priority issue but it hasn't been updated in awhile. @cvializ Do you have any updates?

@vickG Implementation for this feature will start this month. Design is linked above.

that’s great thank you!

On Jun 19, 2018, at 10:47 AM, Ali Ghassemi notifications@github.com wrote:

@VickG https://github.com/VickG Implementation for this feature will start this month. Design is linked above.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/ampproject/amphtml/issues/12079#issuecomment-398486160, or mute the thread https://github.com/notifications/unsubscribe-auth/ADf0c8YVwmlQOBAa_pB26UE59h50ey5Aks5t-TkngaJpZM4QfvGR.

This is a high priority issue but it hasn't been updated in awhile. @cvializ Do you have any updates?

Just wondering about a practical question, having read over the shared API design Google doc. Do we have a sense of what the actual interface would look like? Or would AMP be agnostic to that?

Some of the shared interfaces look great as a start, but from a mobile perspective there are some really great that have been built that we could pull inspiration from.

Hi @jwold, could you share some examples of the mobile-oriented interfaces? The doc is representative of what the PR enables, but it's still in the initial experimental stages so we welcome any suggestions or input.

Happy to jump in! Please consider this an initial dive into the topic, as I just looked at some of the services I've used in the past as well as a I few things I could find with a quick search. I focused mostly on a web based signup process using different services. What I'm specifically looking for are examples where the website has done a good job of breaking down different UI components of the signup process into more digestible and more easily inputtable fields.

These three do a pretty decent job, with Netflix being the most messy. Here goes:

signups

.
.
.

Creative Market blew me away a few years ago with how simple their signup process felt:

group 3

.
.
.

And I always enjoy a good read by checking out what User Onboard has to say about a mobile signup process.

From here it probably makes sense to actually decide how opinionated we want to be with a UI for AMP, versus keeping things more minimal.

Does this help as a starting point?

Yes, thanks for sharing! These are helpful, and I'll share the experimental UI when it's available to compare

This is a high priority issue but it hasn't been updated in awhile. @cvializ Do you have any updates?

amp-inputmask has been launched experimentally by #18631 and this issue will be closed when it is launched into production.

This is a high priority issue but it hasn't been updated in awhile. @cvializ Do you have any updates?

This is a high priority issue but it hasn't been updated in awhile. @cvializ Do you have any updates?

Launched as #14745

Was this page helpful?
0 / 5 - 0 ratings

Related issues

westonruter picture westonruter  Â·  3Comments

gmajoulet picture gmajoulet  Â·  3Comments

mrjoro picture mrjoro  Â·  3Comments

radiovisual picture radiovisual  Â·  3Comments

aghassemi picture aghassemi  Â·  3Comments