Attribute on="change:..." is not working in AMP if I use input file using android camera

777 Views Asked by At

I have an AMP page with a form, it has an input type "file". When you select a photo the form is submitted. I use that to preview the image. It works fine in android and pc, but it fails in android if you choose to take a picture instead of select an image.

In my case, it appears when I click to upload in my android: Options from android If I click file, it works fine. If I click Camera, nothing happens when the pic is took.

The code is simple:

<input type="file"
       name="image"
       id="image"
       tabindex="0"
       on="change:item-form.submit">

Is there a way to trigger "on=change" from Android camera? If not, is there a way to prevent that action for smartphones?

1

There are 1 best solutions below

0
On BEST ANSWER

Use input-debounced or input-throttled : Elements that fire input event same as change event

input-debounced

Fired when the value of the element is changed. This is similar to the standard change event, but it only fires when 300ms have passed after the value of the input has stopped changing.

input-throttled

Fired when the value of the element is changed. This is similar to the standard change event, but it is throttled to firing at most once every 100ms while the value of the input is changing.

For more information