Structinsert - MACROMEDIA COLDFUSION MX 61-CFML Reference

Cfml reference
Hide thumbs Also See for COLDFUSION MX 61-CFML:
Table of Contents

Advertisement

StructInsert

Description
Inserts a key-value pair into a structure.
Returns
True, upon successful completion. If
allowoverwrite = "False"
Category
Structure functions
Function syntax
StructInsert(structure, key, value [, allowoverwrite ])
See also
Structure functions
History
ColdFusion MX: Changed behavior: this function can be used on XML objects.
Parameters
Parameter
structure
key
value
allowoverwrite
Usage
A structure's keys are unordered.
Example
<h1>Add New Employees</h1>
<!--- Establish params for first time through --->
<cfparam name = "FORM.firstname" default = "">
<cfparam name = "FORM.lastname" default = "">
<cfparam name = "FORM.email" default = "">
<cfparam name = "FORM.phone" default = "">
<cfparam name = "FORM.department" default = "">
<cfif FORM.firstname EQ "">
<p>Please fill out the form.
<cfelse>
<cfoutput>
<CFScript>
employee = StructNew();
StructInsert(employee, "firstname", FORM.firstname);
StructInsert(employee, "lastname", FORM.lastname);
StructInsert(employee, "email", FORM.email);
StructInsert(employee, "phone", FORM.phone);
StructInsert(employee, "department", FORM.department);
</CFScript>
structure
, ColdFusion throws an exception.
Description
Structure to contain the new key-value pair.
Key that contains the inserted value.
Value to add.
Optional. Whether to allow overwriting a key. Default: False.
does not exist, or if
key
exists and
StructInsert
705

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents