Pass parameter to html file

Using several techniques, you can pass a value [called a Parameter] from one page to another in order to pre-populate form fields or display on an HTML page.

Sending Page

Values can be sent from the initial [sending] page by creating a link to the destination page that includes parameters linking the variables to be passed. These are then parsed by the receiving page back into values.

Syntax:

/urltopage?var1=@variable1@&var2=@variable2@


Where:

  • urltopage is the relative URL to the destination page.
  • variable1, variable2 etc. are the variable names [e.g. @firstname@].
  • var1, var1 corresponding names for the variables


Examples:

Portal

  • Create a Portal shortcut and associate the link with that shortcut.
/urltopage?var1=@variable1@&var2=@variable2@


Button

  • Create a Read Only - System Variables Custom Field with:
 


Hyperlink

  • Create a Read Only - System Variables Custom Field with:
Click Here

Note: User and Company variables can be used to pass the current logged in user details and their company details.

Receiving Page

On the receiving page the parameters can pre-populate a form or an HTML element which resides on that page. In order to achieve this the following JavaScript functions can be used.

Place the following first function in the head of the HTML.

function getParams[] {
var idx = document.URL.indexOf['?'];
var params = new Array[];
if [idx != -1] {
var pairs = document.URL.substring[idx+1, document.URL.length].split['&'];
for [var i=0; i

Chủ Đề