All things TrackVia!

Read, write, comment.

This is a public Category  publicRSS

Archived FAQ

    • How can I create a Website Form in TrackVia?
      Archived FAQ posted 10/06/08 by Admin, last edited Aug 05 by Matt Strenz, tagged Web Forms
      508 Views, 0 Comments
      question:
      How can I create a Website Form in TrackVia?
      answer:

      Click here to watch a brief demo on creating a website form in TrackVia.

      TrackVia's Website forms allow your database to be populated through an easy to use interface.  This article provides instructions for adding to your website a public form that will populate a TrackVia database. The intended audience is webmasters and others familiar with HTML forms. It covers:

      • Copying and pasting HTML into your website
      • Changing the form's appearance, including removing fields and setting defaults
      • Using a custom response template
      • Redirects and email notification

      First, read the summary instructions on the Website Forms page, which you can get to by clicking the Website Forms link under the Tools section of the Database Overview page (the page with the Search box).

      Copying and Pasting HTML Into Your Website

      The first two steps are to generate HTML for a web form, and copy it and paste it into your web page using your favorite HTML editor. (If you want to quit here, you can – you now have a fully-functioning, albeit unattractive, public TrackVia form!)

      TrackVia offers two different form layouts. The questions above answers layout has field names and input elements in a single line down the page. The side-by-side layout is arranged in a table, with field names on the left and input elements on the right.

      Both of these layouts are very basic, and you'll probably want to modify the HTML to improve your form's appearance. You can do this in several ways:

      • You may change the appearance of any form input or its label – for example, by putting input elements in a table, altering their size, or add stylesheet "class" attributes. TrackVia only requires that the input elements have the correct name and type.
      • You may also remove any input element. TrackVia will assign a (none) value to any database field that's not represented in the form. This is useful for internal tracking fields, such as "status" or "assigned to." You can also remove the time parts of a date/time field. Note, though, that you must not remove the datasetid or securitycode hidden inputs. And if you remove a field that you have indicated is required on the Edit Database page, users will see an error.
      • You may set defaults for any removed or internal fields by changing the input type to "hidden." For example, if the form contains a "status" drop-down list that you'd like to remove and set to a default of "not started," simply replace its entire <select>...</select> block with
        <input type="hidden" name="text036" value="not started">
        Be sure to keep the name of the input element the same – in this case, text036.
        Date/time defaults should be in YYYY-MM-DD HH-MM-SS format:
        <input type="hidden" name="datetime000" value="2006-05-25 18:30:00">
        Checkbox group defaults should use a value of on for each choice:
        <input type="hidden" name="text072-volunteer" value="on">
        <input type="hidden" name="text072-donor" value="on">
        Uploaded file fields cannot have defaults.

      Make sure to test your form with a variety of input values, including blank values, for each form element. Check the records that show up in your TrackVia database. TrackVia will provide basic type checking (numbers must be numbers, emails must be valid), and validate that required fields are not blank. If you desire more complex validation or back-end custom processing, please contact us. Charges may apply.

      Using a Custom Response Template

      TrackVia's error and confirmation messages are quite plain. However, when a record is submitted, TrackVia can send a response that looks and feels like your own website. To enable this, simply provide the public URL of the page containing your finished form, or upload the HTML file that contains your form. TrackVia will use either of these to construct a response template that looks like your site.

      When building the response template, TrackVia will replace everything between the <!-- #public_form# start --> and <!-- #public_form# end --> tags with the error or confirmation message. (These tags were generated for you in the previous step.) Make sure your entire form is contained within those tags, along with anything else you don't want to appear in the response, such as instructions or introductory text. Other tips:

      • If your webpage uses images from your site, they may not be referenced correctly when the template is delivered from a TrackVia domain. To fix this, add the following at the beginning of the <HEAD> section of your HTML file:
        <base href="http://www.your-domain-name.com">
        Be sure to replace your-domain-name with your website's actual domain name. This step is done for you if you provide a public URL, but you'll have to do it yourself if you upload an HTML file.
      • Similarly, you may need to add http://www.your-domain-name.com/ to other parts of your webpage:
        • the src attribute of any JavaScript <script> elements
        • the href attribute of any stylesheet <link> elements
        • the url() part of any style attributes in any elements
        • the location.href=... part of any JavaScript event handlers (onclick, etc.)
        If these are required, you'll have to use the upload-HTML technique, rather than the public URL technique. Try the <base href="..."> trick first, though, as often that is sufficient.

      Redirects, Email Notification, and Cross-Submitting

      Another option for the confirmation page is to supply the URL of your own confirmation page. If you add a hidden input element to your form like this:

      <input type="hidden" name="redirect" value="http://www.your-own-site.com/thankyou.htm">

      then TrackVia will redirect the user to the provided URL when the form is submitted. (Note that you still may want to upload a response template for TrackVia to use for error messages.)

      You can also have a copy of each form submission sent to you by email. If you add a hidden input element to your form like this:

      <input type="hidden" name="emailcc" value="you@whatever.com">

      then TrackVia will send a copy of the record that gets created to the email address specified. You can also specify multiple email addresses in the value attribute, separated by commas. To change the subject, from name, or from address of these emails, use similar hidden inputs called emailcc_subject, emailcc_fromname, and emailcc_fromaddress.

      Finally, you can also have a website form cross-submit data into a second database. For example, suppose you have a website form that submits into a database called Feedback. You'd like Feedback submissions to cross-submit into a database called Mailing List. To do this, add the following hidden input to your Feedback form: input in your form:

      <input type="hidden" name="crosssubmit" value="Mailing List">

      You can list more than one cross-submission database by separating the database names with commas. In each additional database, only those fields whose names and data types match the original database will be populated. For example, if Name, Phone, and Email are the only fields in the Feedback and Mailing List databases that have the same names and data types, they are the only fields that will be populated in the Mailing List record that gets created when a new Feedback record comes in. The new Mailing List record will include a link to its matching Feedback record in its Notes section.

      Our final advice: test it! Test your form in as many ways as you can think of. And please contact TrackVia Support if you have questions or problems.