Acquire location

In almost every service you need to acquire user's location. This can be easily achieved with variables in URL - for example http://mycoolservice.com?lat=$lat&lon=$lon. But in most cases you want user to change his location - acquire from gps, type an address etc. In these cases use this slightly modified XHTML form.

Locify:variables and locify:where

You can use <locify:variables> tag in any XHTML form for setting values of inputs. You can use variables to fill location data. Read more in locify namespace reference.

<locify:where> is a special form component, which allows user to select location. See screenshot below. When using this tag, you need to set lat/lon into hidden fields in your form.

Example

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:locify="http://client.locify.com/locify_ns/1.0" xml:lang="en" lang="en">
  <head>
    <title>Acquire location</title>
  </head>
  <body>
    <form action="http://www.mycoolservice.com/process.php" method="post">
      <locify:variables>
        <locify:element name="latitude" value="$lat" />
        <locify:element name="longitude" value="$lon" />
      </locify:variables>
      <fieldset>
        <locify:where />
        <input type="hidden" name="latitude" value="" />
        <input type="hidden" name="longitude" value="" />
        <input type="submit" value="Send!" />
      </fieldset>
    </form>
  </body>
</html>

How it looks like

Acquire location screenshot