Request a parameter for the server behavior – Adobe Dreamweaver CC 2014 v.13 User Manual
Page 552

cfsqltype="CF_SQL_INTEGER"> cfsqltype="CF_SQL_VARCHAR"> Note: Parameter arrays cannot be used outside of a loop except as part of a conditional directive expression. Using the loop directive’s _length and _index variables The loop directive includes two built-in variables that you can use for embedded if conditions. The variables are: _length and _index. The _length An example of using built-in variables is to apply them to the import attribute of the page directive. The import attribute requires comma separation <@loop (@@Import@@)@> <@ if(_index == 0)@>import=" <@endif@>@@Import@@<@if (_index == _length-1)@>"<@else@>, <@ endif @> <@endloop@> Request a parameter for the server behavior Server behaviors often require that the page designer supply a parameter value. This value must be inserted before the server behavior’s code is You create the dialog box by defining the designer-supplied parameters in the code. Then you generate a dialog box for the server behavior, which Note: A parameter is added to your code block without your intervention if you specify that your code should be inserted relative to a specific tag Define the parameter in the server behavior code 1. Enter a parameter marker in the code where you want to insert the supplied parameter value. The parameter has the following syntax: @@parameterName@@ 2. Enclose the formParam string in parameter markers (@@): <% Session("lang_pref") = Request.Form("@@formParam@@"); %> For example, if the server behavior contains the following code block: <% Session("lang_pref") = Request.Form("Form_Object_Name"); %> To require the page designer to supply the value of Form_Object_Name, enclose the string in parameter markers (@@): <% Session("lang_pref") = Request.Form("@@Form_Object_Name@@"); %> You can also highlight the string and click the Insert Parameter In Code Block button. Enter a parameter name and click OK. Dreamweaver Dreamweaver uses the strings that you enclose in parameter markers to label the controls in the dialog box it generates (see the following Note: Parameter names in the server behavior code cannot have any spaces. Therefore, the dialog box labels cannot have any spaces. If you 545
variable evaluates to the length of the arrays processed by the loop directive, while the _index variable evaluates to the current index of the loop
directive. To ensure that the variables are only recognized as directives, and not as actual parameters to be passed into the loop, do not enclose
either variable in @@s.
of packages. If the loop directive extends around the entire import attribute, you would only output the attribute name import= on the first iteration
of the loop—this includes the closing double quote (")—and not output a comma on the last iteration of the loop. Using the built-in variable, you
can express this as follows:
inserted into the page.
prompts the page designer for a parameter value.
chosen by the page designer (that is, you chose Relative to a Specific Tag in the Insert Code pop-up menu). The parameter adds a tag menu to
the behavior’s dialog box to let the page designer select a tag.
replaces every instance of the highlighted string with the specified parameter name enclosed in parameter markers.
procedure). In the previous example, Dreamweaver creates a dialog box with the following label: