Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug ?] Work better with forms #1

Open
phischdev opened this issue Jun 15, 2023 · 5 comments
Open

[bug ?] Work better with forms #1

phischdev opened this issue Jun 15, 2023 · 5 comments

Comments

@phischdev
Copy link

phischdev commented Jun 15, 2023

Hey Andrew,
thank you for releasing this component.

Is there any way to make it more compatible with forms?

  • For example add validation to be able to make the location required
  • Or auto-location without displaying button or text
  • make the Lat and Long fields show up in form bindings like with other input fields

Best,
Philipp

@phischdev
Copy link
Author

Looking into your code, you implemented the third point already.
Something is off though:

The field-names for Lat and Long don't show up in the bindings suggestions of the form the geolocation component is in.

There is a number input component and your geolocation component in the same form
image

I'm setting a form field with the number input called stopKM
image

And I'm setting two form fields with your geolocation input, called stopLong and stopLat
image

Then I want to use these fields in a query
image

Unfortunately, while stopKM from the number input is being forwarded to the query correctly, stopLong and stopLat just stay at their default value 0 when the query is executed.

The two number fields also don't show up in the bindings editor
image

Then on the other hand, during execution, the debugger shows me that the form has received the correct numbers:
image

I'm very new to budibase. I assume this to be an issue with the geolocation component because everything works with the built-in number input component. What do you think @andz-bb ?

@phischdev phischdev changed the title Work better in forms [bug ?] Work better in forms Jun 16, 2023
@phischdev phischdev changed the title [bug ?] Work better in forms [bug ?] Work better with forms Jun 16, 2023
@phischdev
Copy link
Author

A difference I noticed is that the initial values differ for the fields
image

StopKM from the number field has null as initial value while geolocation's inital values are empty strings "".

Maybe setting an empty string as initial value for a field of type number causes Issues?

image image

@andz-bb
Copy link
Owner

andz-bb commented Jun 16, 2023

Hey @phischdev, thanks so much for your interest in my plugin and for your detailed investigation.

Based on your suggestion, I have implemented configurable validation for the latitude and longitude fields in v1.4.0 of the plugin.

I have just pushed an update v1.5.2 that includes the automatic mode that you've suggested. It will request the location after the configured delay. I've also added settings to hide the button or the output.

I've been unable to recreate the bindings issues on my end and have been able to send my lat/long values as bindings to a REST query successfully. Could you send me your app export or a demo app so that I can investigate the issues that you're seeing? Any help would be much appreciated!

Thanks again for your contributions here, have a great weekend! 😎

@phischdev
Copy link
Author

Hey @andz-bb,
Thanks a lot for your quick action. Validation and automatic location work perfectly.

Out of interest: What is the use case for delayed auto-location?

Regarding my issue/bug:

  • When you create a new form and add a geolocation input, do the lat and long fields appear in the form?
    image

I'll try to setup a demo app soon

Enjoy your week!

@andz-bb
Copy link
Owner

andz-bb commented Jun 20, 2023

hey @phischdev - glad to hear those bits are working!

I had imagined it might be frustrating if the user was immediately asked for location permissions when loading a screen with the component, so I added in the timer as an optional way to delay that popup so that it is maybe less annoying for the end user. I don't know if people will find it useful but I thought it was worth throwing in anyway. If it is unnecessary or confusing I can take it out :)

Let me know when you have a small demo ready and I will gladly have a look. Thanks again for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants