Search these areas:
Help
Support Forums
Product Info



-Introduction
-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Views
-Templates
-Components
-Data Analysis
-Members
-Security
-Importing
-Exporting
-FTP
-JavaScript
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-Glossary
-New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

Script Library

  Echo URL name/value parameters
 
  chubbard posted this script:
  request.getParameter() works well if you happen to know the names of the parameters that are being passed into your function.  But if you don't know them, getParameter won't help.  Here's a quick and dirty function that parses the query string portion of a URL, and grabs the name-value pairs of the parameters.  Of course, for this to work, the data has to be in the URL...so while forms submitted via GET will work with this, forms with method=POST will not.

webcall function echo() {
  <ws:tags>
  ECHOFUNC<BR>
  </ws:tags>

  // Split the query portion of the string into name-value pairs (on the "&" symbol).
  // queryArray elements will be strings of "<paramName>=<paramValue>" format.
  var queryString = request.getQueryString();
  var queryArray = queryString.split("&");

  // Iterate through the array of name-value pairs
  for (var i=0; i<queryArray.length; i++) {
    // set pName to the parameter name, ie the text before the "="
    var pName =
      response.decodeURL(queryArray[i].subString(0,queryArray[i].indexOf("=")));
    // set pVal to the parameter value, ie the text after the "="
    var pVal =
      response.decodeURL(queryArray[i].subString(queryArray[i].indexOf("=")+1,queryArray[i].length));

    // Output the name-value pair
    <ws:tags>
      <%= pName %> = <%= pVal %><BR>
    </ws:tags>
  }

  return;
}
 
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us