JAVASCRIPT PARSEFORM
Rev 2: December 2004

    ITEM OF 10    

red blue green
user:
color:

Source/Downloads
  • parseform.js (4k)
  • parseform.html (4k)
  • parseform.zip (4k)
  • In General: This page demonstrates parse_form(), a quick and dirty global utility designed to automatically retrieve and intialize name->value pairs submitted via the QUERY_STRING portion of the document's curent location.
        example.html?user=anonymous&color=red
    

    If successful, parse_form() stores the resulting name->value pairs in a global associative array named formdata. Values are thereafter accesible using the standard syntax formdata["name"]:

        var user=formdata['user'];
        var color=formdata['color'];
    

    parse_form() works with control-name/control-value pairs resulting from a standard html form get method submit -- but cannot access post method data.

    parse_form() works equally well with name->value pairs hard coded into e.g. an anchor link href by the designer (or another script):

        <a href="example.html?item=9">Next</a>
    

    It can be used to support and help standardize any application that requires passing data from one location to the another, including: search utiltities, contact applications, sequential slideshows, weblogs and more.



    In General: parse_form() makes a nice addition to a global.js file.

    < CODEBASE | TOP^ | MAINPAGE >

    Text & Design By Tony Pisarra
    © SophiaKnows 1998-2004