Skip Navigation

[Resolved] I want set default value (use my location) in address field

This support ticket is created 4 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 1.84 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by ahmedA-7 4 years, 5 months ago.

Assisted by: Shane.

Author
Posts
#1655377

Tell us what you are trying to do?

I have form with location field (address) and there is already link (Use my location) the user can set his currently location.

I want set default value (use my location) in address field instead of the user pressing on link ( Use my Location)

#1655803

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ahmed,

Thank you for getting in touch.

Unfortunately no it is not possible to set the "use my location" button to automatically get the user's location.

However looking on it, it may be possible to write some javascript to press that button on the page load but can't guarantee that it will work.

jQuery('#foo').trigger('click');

Given that this would require custom code then I would be able to assist much with this as custom coding is out of the scope of our support forum.

Please let me know.
Thanks,
Shane

#1659179

Well, in another way, can the form be displayed only if the user is close to a specific location? And if the user is away from the location, the form hidden?

I want the user to submit the form from a specific location only, if the user currently location is away from the specific location. The user cannot submit the form.

how I can know the current user's location if the form is submitted?

#1660273

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ahmed,

Well, in another way, can the form be displayed only if the user is close to a specific location? And if the user is away from the location, the form hidden?

You should be able to do it with this shortcode below.
https://toolset.com/documentation/user-guides/maps/maps-shortcodes/#toolset-maps-distance-conditional-display

So if you wrap the form shortcode inside the toolset-maps-distance-conditional-display it should display only when the user is within a certain distance of a fixed location.

Please let me know if this helps.

Thanks,
Shane

#1660309

My issue is resolved now. Thank you!

#1662343

Yes it works but it was discovered that only if the user is browsing through a computer, but if the user is browsing through the mobile the form does not appear

If the content is text that works in the mobile browser, but if the content is a form that does not appear in the mobile browser