TOPIC:

GPS-Position abzufragen 4 years 6 months ago #218783

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 141
  • Karma: 1
  • Thanks: 1
Hallo zusammen,

ich würde gerne Formulare erstellen, bei denen in einem Pflichtfeld GPS-Daten hinterlegt werden oder noch schöner wäre es, wenn man bestimmte Formulare erstellt, die nur in bestimmten GPS-Positionsbereichen angezeigt würden.

Wie kann ich das bewerkstelligen, dass die aktuellen GPS / location-based Position in meinem Formular - in welcher Weise auch immer zunächst - dargestellt wird.

In HTML5 gibt es ja schon sowas implementiert... jedoch wie würde ich das im Formular-Inhalt eintragen?

Danke euch und gruß

Please Log in or Create an account to join the conversation.

GPS-Position abzufragen 4 years 6 months ago #218816

  • DarkoCujic's Avatar
  • DarkoCujic
  • Offline
  • Developer
  • Developer
  • Posts: 2154
  • Karma: 67
  • Thanks: 265
Hey there,

I hope we can continue this topic in English as we're currently a bit low on German speaking staff.

If I understood you right, you want to incorporate GPS location to your forms. I presumed you have one textfield for latitude and one for longitude. The code is:
function ff_geolocation_init()
{
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition( displayLocation, handleError );
    } else {
        ff_getElementByName('ff_nm_latitude[]').value = ff_getElementByName('ff_nm_longitude[]').value = 'Your browser does not support geolocation.';
    }
} // ff_geolocation_init

function displayLocation(position){
  ff_getElementByName('ff_nm_latitude[]').value = position.coords.latitude;
  ff_getElementByName('ff_nm_longitude[]').value = position.coords.longitude;

}

function handleError(error){
  switch(error.code) {
      case error.PERMISSION_DENIED:
          ff_getElementByName('ff_nm_latitude[]').value = ff_getElementByName('ff_nm_longitude[]').value = "User denied the request for Geolocation."
          break;
      case error.POSITION_UNAVAILABLE:
          ff_getElementByName('ff_nm_latitude[]').value = ff_getElementByName('ff_nm_longitude[]').value = "Location information is unavailable."
          break;
      case error.TIMEOUT:
          ff_getElementByName('ff_nm_latitude[]').value = ff_getElementByName('ff_nm_longitude[]').value = "The request to get user location timed out."
          break;
      case error.UNKNOWN_ERROR:
          ff_getElementByName('ff_nm_latitude[]').value = ff_getElementByName('ff_nm_longitude[]').value = "An unknown error occurred."
          break;
  }
}

To make this work for you, you're going to have to change:
- in line 1: function ff_geolocation_init() -> function ff_YOURFORMNAME_init()
- everywhere you see ff_nm_longitude[] -> ff_nm_NAME-OF-YOUR-TEXT-FIELD-FOR-LONGITUDE[]
-everywhere you see ff_nm_latitude[] -> ff_nm_NAME-OF-YOUR-TEXT-FIELD-FOR-LATITUDE[]

Let me know if this is what you wanted and if you need assistance implementing this.

Kind regards,
Darko
Satisfied with our support? PayPal tips
===========
Need to renew Pro Support? Buy Here!
===========
Satisfied? Consider a membership!
===========
Like us on Facebook
===========
Support Crosstec and get ALL EXTENSIONS and professional support for just $5. Here!

Please Log in or Create an account to join the conversation.

GPS-Position abzufragen 4 years 6 months ago #218855

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 141
  • Karma: 1
  • Thanks: 1
okay. i will try it in the next days...

maybe, after createing an admin email... you know a possibilty to create a link to (maybe) googlemaps like www.googlemaps.com/longit=FIELDNAME_LONG&latid=FIELDNAME_LATI or something like this.

is this possible?

Please Log in or Create an account to join the conversation.

GPS-Position abzufragen 4 years 5 months ago #218862

  • DarkoCujic's Avatar
  • DarkoCujic
  • Offline
  • Developer
  • Developer
  • Posts: 2154
  • Karma: 67
  • Thanks: 265
Hey,

of course it's possible. Select your form > Advanced tab > More options > Admin Emails. You're going to have to switch to using Custom emails, select Yes on Send as HTML, and in the text area below where you want to insert the link, just paste the following:
<a href="https://www.google.com/maps/search/?api=1&query={latitude:value},{longitude:value}">click for link to maps</a>
My fields are named latitude and longitude, so you'll have to adjust that to the names of your fields. You can even select them in the area to the right of the textarea to insert them in the mail template. See screenshot please. Only the edit emails, send as HTML and the code part is important. The rest is up to you.

Let me know if this works for you.

Kind regards,
Darko
Satisfied with our support? PayPal tips
===========
Need to renew Pro Support? Buy Here!
===========
Satisfied? Consider a membership!
===========
Like us on Facebook
===========
Support Crosstec and get ALL EXTENSIONS and professional support for just $5. Here!
Attachments:

Please Log in or Create an account to join the conversation.

GPS-Position abzufragen 4 years 5 months ago #218919

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 141
  • Karma: 1
  • Thanks: 1
sorry i ask again.

where i have to put in the code you write above?
is it a script or a part of the form (action, initalize or what ever)?
Thanks again

Please Log in or Create an account to join the conversation.

GPS-Position abzufragen 4 years 5 months ago #218925

  • DarkoCujic's Avatar
  • DarkoCujic
  • Offline
  • Developer
  • Developer
  • Posts: 2154
  • Karma: 67
  • Thanks: 265
Hey,

it's not a problem.

The code from my first post has to go to the Initialization script (select your form > Advanced tab > More options > Scripts).
And the code for the link to the entry is in the admin mail (or mailback if you need it).

If you need it, I also have the code to display their position on a map. But it's just for a preview of their location, you can't "select" a location with it. So let me know if you need/want it, and I'll post it here.

Kind regards,
Darko
Satisfied with our support? PayPal tips
===========
Need to renew Pro Support? Buy Here!
===========
Satisfied? Consider a membership!
===========
Like us on Facebook
===========
Support Crosstec and get ALL EXTENSIONS and professional support for just $5. Here!

Please Log in or Create an account to join the conversation.

Moderators: ForumSupport
Time to create page: 0.052 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!