Share via


InputParameters Collection

InfoPath Developer Reference

Represents a collection of InputParameter objects.

Version Information
 Version Added:  InfoPath 2007

Remarks

The InputParameters collection can be used to access the Name and Value properties of each InputParameter object. It is not possible to add new InputParameters using the InfoPath object model.

This collection is populated when a form template is opened from the command line with the

/InputParameters

option and one or more name/value pairs, separated by the ampersand (&) character, or from a URL string that specifies input parameters.

Example
In the following example, an InfoPath form template is invoked from the command line using the following syntax:

  infopath.exe "C:\User Forms\DeptReport.xsn" /InputParameters "Dept=Accounting&Class=Introduction"

Or from a URL using the following syntax:

  http://server/sites/team/training/Forms/template.xsn?Dept=Accounting&Class=Introduction

In the OnLoad event, the Department field is populated with the value "Accounting".

JScript
  function XDocument::OnLoad(eventObj)
{
   var vDept = XDocument.InputParameters["Dept"].Value;
   XDocument.DOM.selectSingleNode("/my:myFields/my:Department").text = vDept;
}

In the following example, the InputParameters collection is used to enumerate through the name/value pairs passed in through a command-line or URL, and display each pair in an alert.

JScript
  var varIParams = XDocument.InputParameters
	
	for( var enumtor = new Enumerator(varIParams) ; !enumtor.atEnd(); 
	enumtor.moveNext() )
	{
		XDocument.UI.Alert("Name: " + enumtor.item().Name + "\nValue: " + enumtor.item().Value);
	}

See Also