Javascript not running on mobile device

I created a form in mobile view on retool.
I attached a javascript to submit the form to an API.

It runs fine in mobile view on desktop but it doesn't submit to the API on mobile phone.

Please help.

See attached relevant screenshots.


1 Like

Hey @Adeola_Ibigbemi!

Is your SubmitStatus handler catching any errors?

I'm curious what you see if you do something like

const response = await fetch(/* your params */);
utils.showNotification({title: reponse.status});

If there's any error further up in the script, it may help to see it in its entirety!

the submit button seems not to be responding at all while testing with mobile device.
But it works on desktop.

Hmm... interesting, for some more context:

  1. Are you ever using a public link to access the app?
  2. What device are you testing on?
  3. Would you mind if I stepped into your org to take a look at the app myself?

Hi, has this been resolved? I'm having a similar issue. Thanks

Yes, it has been resolved.
The error was from the backend API that I was calling.

I was passing some images to it, but the size of the resulting payload is more than the maximum specified in the nginx config.

Everything went fine when I changed the config in nginx

Ok, then it must be something else.
When I call the fetch() method, it runs fine on the simulator, but I get a "fetch variable not found" error on the device.

Hey @alessandrogalli!

The fetch API actually isn't supported in Mobile apps, the fact that it works in the editor is a side-effect of it being run in a different JS environment at the moment.

Could it work to use a REST query instead? You should still be able to trigger it from your JS query (see docs here). Triggering the query will return a Promise that will give you much of the same functionality as fetch albeit with a slightly different API.