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

Support Forum



passing url parameters
tannagx asked:
This line of code is in a .ws file. The id variables are inserted into tables correctly, and now I want to send these parameters into a view.

Response.setRedirect("InsertReview.view?PersonID=form_PersonID&EmployeeID=form_OwnerID");

The correct view is reached, however the values of the parameters are not available. I know that if there were parameters the form would work correctly because the default getParameters work when the view is previewed.

Thanks,
Tanna
 
  brittp responded:
  are form_PersonID and form_OwnerID variable names?

if so, you probably want this:

Response.setRedirect("InsertReview.view?PersonID=" + form_PersonID + "&EmployeeID=" + form_OwnerID);

the previous code passes the literal strings "form_PersonID" and "form_OwnerID" to InsertReview.view.
 
  tannagx responded:
  Yes,  form_PersonID and form_OwnerID are variable names. I added the + operator but the response.write still shows form_PersonID and form_OwnerID as strings.

Response.setRedirect("InsertReview.view?PersonID=+form_PersonID&EmployeeID=+form_OwnerID");

Response.setRedirect("InsertReview.view?PersonID='+form_PersonID'&EmployeeID='+form_OwnerID'");

In both cases the quotes were passed in as a string. For some reason I'm not getting the value of the variables. .view pages use ## signs, is there something similar I need in a .ws page?

Thanks,
Tanna
 
  brittp responded:
  tanna,

your issue is still a matter of syntax: both of the samples in your reply have errors.

example 1:  Response.setRedirect("InsertReview.view?PersonID=+form_PersonID&EmployeeID=+form_OwnerID");

here, you've just added '+' signs to your strings.  now "+form_PersonID" will be passed instead of "form_PersonID".

example 2:  Response.setRedirect("InsertReview.view?PersonID='+form_PersonID'&EmployeeID='+form_OwnerID'");

here, you've added both single quotes and a plus sign:  "'+form_PersonID'" will be passed instead of "form_PersonID".

the real problem here is the javascript string syntax.  if you start a string with a double-quote ("), everything typed (including plus-signs and single-quotes) will be interpreted as a string literal until another double-quote is encountered.  the same logic applies to strings started with a single-quote: everything in the string (including plus-signs and double-quotes) will be interpreted as a string literal until the closing single-quote is found.

to test your string generation, try using script.log() to write the string to the event log: this will prevent any confusion as to whether the problem is in the string generation versus the view that you're redirecting to.

try using the code that I posted in my first response.

britt
 
  tannagx responded:
  I copied and pasted your code, and included the script.log(). Both worked wonders. :o)

Thanks,
Tanna
 
  brittp responded:
  DataWeb considers this issue closed.
If you have additional questions or comments about this issue, please open it again.
If you have questions about a different topic please open a new support question.

Thanks,
DataWeb Support
 
  tannagx responded:
  This issue is open.  
  tannagx responded:
  DataWeb considers this issue closed.
If you have additional questions or comments about this issue, please open it again.
If you have questions about a different topic please open a new support question.

Thanks,
DataWeb Support
 
  Please Log On
or create your own DataWeb Account.
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