Developing a Whitebeam Application

Site Map
 
Home
 
Application Guide
  Quick Start
    Introduction
    Application
    Administration
    Source
    Structure
    Forms Data
    Sessions
    Access Ctrl
    Templates
    Files
    Debug
    File Loc
    Hints+Tips
  PHP and ASP
  Writing Apps
  Applications
  Tutorials
  Samples
Reference
Community
Contact Whitebeam
To-Do
Download
Credits
Licence
Whitebeam Users
 
 
 

Developing a Whitebeam Application

Form Data

All applications will use forms to input data from a user's browser and the Whitebeam system provides a very easy mechanism with which to read the data into an application. The form data can be submitted with a GET or a POST (or indeed the input could be made in the form of a "manual GET" by means of URL parameters such as www.redbourne.com/input.rhtm?count=342); in either case a call to the rb.page.formdata() method gets the parameters. These parameters become properties of the object returned, the name being the name of the parameter, with a value set to the parameter value. Automatic "unescaping" of encoded parameters is performed by the method to make manipulation as straightforward as possible.

As an example consider a form that POSTs two pieces of data: 1) a text entry box and 2) a submit button:

<html>
  <head>
    <title>Form Example</title>
  </head>
  <body bgcolor="#FFFFFF">
    <form name="form1" enctype="multipart/form-data"
          method="post" action="process.rhtm" >>
      <input type="text" name="textfield">
      <input type="submit" name="Submit" value="Submit">
    </form>
  </body>
</html>

The process.rhtm pattern page that processes this form could look like this:

<html>
  <head>
    <title>Form Processor</title>
    <rb:script>
      var formdata = rb.page.formdata();
      var suppliedText = formdata.textfield;
    </rb:script>
  </head>
  <body bgcolor="#FFFFFF">
    The data supplied was <rb:eval expr="suppliedText"/>
  </body>
</html>

Some key points about form data:

  • text input parameters are always sent by a GET or POST although their contents will be empty (i.e. formdata.textItem == "") if the user has not entered any data

  • button input parameters (submit, radio etc.) will only be sent when the item is selected otherwise they will not be present (i.e. formdata.buttonName == null)

  • select input parameters ( menu, list) are only sent if selected. If the select is MULTIPLE and the user selects more than one option on the form the contents will be made available as an array (i.e. formdata.selectName[i] where i = 0, number of items selected - 1)

  • file input parameters are always sent although their contents will be empty if the user has not selected any file (i.e. they have no length formdata.fileName.length == 0). Note that the Whitebeam system defines a special File type that has a number of special methods.

Whitebeam release 1.3.36
(loadtime : 7ms)