Definition of Whitebeam XML Tags

Site Map
 
Home
 
Application Guide
Reference
  Installation
  Configuration
  XML Markup
    authenticate
    block
    cachecontrol
    eval
    false
    header
    include
    insertblock
    insertdebug
    macrotag
    marksession
    nomacro
    noscript
    parser
    redirect
    repeatfor
    return
    script
    if
    test
    true
    xmp
    eval
    id
    marksession
    test
  JavaScript Classes
  ROM
  Templates
  Environment
  Dev Process
  Tools
  External Links
  Example libraries
Community
Contact Whitebeam
To-Do
Download
Credits
Licence
Whitebeam Users
 
 
 

Definition of Whitebeam XML Tags

rb:redirect

Server-side redirect to another page

Body

The body of this tag is always empty.

Attributes

Attribute Required Description

src

implied

Target for the redirection. The virtual-server based path to the file to load in place of the current one.

Remarks

This function directs the Presentation Engine to discard the output from the page currently being generated and instead to load an alternative page, run that and use the output as the generated results for this page.

The 'src' attribute is the path name of the alternative resource to load. The name is relative to the file system root of the clients virtual server

Some notes:

  1. The Presentation Engine does not abort execution of the current page. Execution is completed then the output is simply discarded. This means that subsequent server side interactions with the templates will still take place!

  2. The 'environment' that the redirected page sees is identical to that of the original page - that is it the rb.page.env.xxxx() methods return the same values, the HTTP access method is the same and the parameters are the same.

  3. The redirected page can in turn direct to a further page.

One of the most valuable uses for redirection is in the development of server-side processed forms - or more precisely a sequence of forms similar to a 'wizard' - where the user completes a multi-page form. Having completed the first page the user moves to the next page.

Traditionally each 'form' would comprise two parts - the display of the form and the processing of the data when it is submitted. Often a single file would contain the display of one page and the processing of the previous page.

With 'redirect' the author can keep all this functionality in one file. The page can look at the form post data and decide whether or not the data is being submitted. If it is NOT being submitted then it displays the page. If it is being submitted it process the form-data and then issues a <rb:redirect...> tag to get the next page to display its data.

Example:

<rb:script>
   var formdata = rb.page.formdata();
   var submit   = formdata.firstname;
</rb:script>
<rb:test expr="submit"/>
   <rb:true>
      <!-- This is a submit. Process the form data. -->
      <rb:script>
         processFormData(formdata);
      </rb:script>
   </rb:true>
   <rb:false>
      <!-- NOT a submit - display the form -->
      <form ACTION="wiz1.rhtm" rb:marksession=yes
            METHOD="POST" enctype="multipart/form-data">
         <table border="1">
           <tr><td>First Name</td>
               <td><input type="radio" name="action"
                          value="add" checked> </td>
           </tr>
           <tr><td>First Name</td>
               <td><input type="text" name="firstname"> </td>
           </tr>
           <tr><td>Surnane Name</td>
               <td><input type="text" name="surname"> </td>
           </tr>
           <tr>
               <td><input type="file" name="picture"></td>
           </tr>
           <tr>
               <td><rb:eval expr="documents[y].name"/></td>
           </tr>
           <tr>
              <td><rb:eval expr="documents[y].descr"/></td>
          </tr>
        </table>
     </form>
  </rb:false>
</rb:test>
Whitebeam release 1.3.36
(loadtime : 9ms)