Form

There have been some changes in format for older versions of Locify. See documentation for Locify 0.8.1 and older.
If you plan support for versions older than 0.8.5, you need to detect client version and serve correct screen.

Form is main input tool for any service. You can get input from user, get location-based data and much more. You can use forms for service settings or creating new local points as well.

Note that Locify currently supports only POST method of forms.

Format

<?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>Form-title</title>
  </head>
  <body>
    <form action="Form-action-url" method="post">
      <locify:variables>
        <locify:element name="Name-of-input" value="Default-value" />
        <locify:element name="Name-of-select" value="Default-value" />
      </locify:variables>
      <fieldset>
        <label>Input-label: <input type="text" name="Name-of-input" value="" /></label>
        <label>Input-label:
        <select name="Name-of-select">
          <option value="Option-value">Option-name</option>
          <option value="Option-value">Option-name</option>
        </select></label>
        <p>Additional-text</p>
        <input type="hidden" name="Input-name" value="Input-value" />
        <input type="submit" value="Button-text" />
      </fieldset>
    </form>
  </body>
</html>

Parameters

  • Form-title - Page title
  • Form-action-url - URL form is sent to. You can use internal URLs there.
  • Input-label - Label of input or select
  • Name-of-input - Name, which will be used in sending
  • Default-value - Preffiled value. Variables can be used here for getting GPS data or using settings.
  • Option-value - Value of select's option
  • Option-name - Label of select's option
  • Additional-text - Some plaintext can be added for example for help texts
  • Button-text - Text shown on sending button

Default values (locify:variables)

You can enter Locify special variables like GPS data or service settings using <locify:variables> element.

It can contain one or more <locify:element> tag. This is optional part of form and you can use value attribute of form elements as well. If you use both, the value in <locify:element> is used.

Note: You can still use variables in value attribute as in Locify 0.8, however this is deprecated and locify:selected attribute of <select> is no longer supported.

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>My cool form</title>
  </head>
  <body>
    <form action="http://www.mycoolservice.com/submit" method="post">
      <locify:variables>
        <locify:element name="latitude" value="$lat" />
        <locify:element name="longitude" value="$lon" />
        <locify:element name="altitude" value="$alt" />
      </locify:variables>
      <fieldset>
        <label>Latitude: <input type="text" name="latitude" value="" /></label>
        <label>Longitude: <input type="text" name="longitude" value="" /></label>
        <p>User info:</p>
        <label>Pick your fruit:
        <select name="Name-of-input">
          <option value="1">Apple</option>
          <option value="2" selected="selected">Blueberry</option>
        </select></label>
        <input type="hidden" name="altitude" value="" />
        <input type="submit" value="Send!" />
      </fieldset>
    </form>
  </body>
</html>

How it looks like

Form screenshot