
465
DEVELOPING
COLDFUSION 9 APPLICATIONS
Accessing and Using Data
Las
t
upda
te
d 8/5/2010
<cfelseif Form.action is "Retrieve">
<cfldap name="GetEntry"
server=#myServer#
action="query"
attributes="cn,sn,mail,telephonenumber,uid"
scope="subtree"
filter="uid=#Trim(Form.UID)#"
start="o=Airius.com">
<cfset fullNameValue = GetEntry.cn[1]>
<cfset surnameValue = GetEntry.sn[1]>
<cfset emailValue = GetEntry.mail[1]>
<cfset phoneValue = GetEntry.telephonenumber[1]>
<cfset uidValue = GetEntry.uid[1]>
<cfelseif Form.action is "Delete">
<cfldap action="delete"
dn="uid=#Trim(Form.UID)#, ou=People, o=Airius.com"
server=#myServer#
username=#myUserName#
password=#myPassword#>
<cfoutput><h3>Entry for User ID #Form.UID# has been deleted
</h3></cfoutput>
3
At the end of the code for the Add button (the
input
tag with
Value=Add
at the bottom of the form
)
, delete the
</td>
end tag.
4
After the end of the Add button
input
tag, add the following code:
 
<input type="Submit"
name="action"
value="Retrieve"
tabindex="7">
 
<input type="Submit"
name="action"
value="Delete"
tabindex="8"></td>
5
Save the file and run it in your browser.
Reviewing the code
The following table describes the code: