The cfldap tag lets you change the values of entry attributes. To do so, you specify the entry DN in the dn attribute, and list the attributes to change and their new values in the attributes attribute.
The following example builds on the code that adds and deletes an entry. It can update one or more of an entry's attributes. Because the UID is part of the DN, you cannot change it.
The following table describes the code:
Code |
Description |
---|---|
<cfelseif Form.action is "Update"> <cfset attributelist="cn=#Trim (form.FullName)#; sn=#Trim(Form.surname)#; mail=#Trim(Form.email)#; telephonenumber=#Trim(Form.phone)#"> <cfldap action="modify" modifytype="replace" attributes="#attributeList#" 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 updated</h3> </cfoutput> |
If the user clicks Update, sets the attribute list to the form field values and replaces the attributes for the entry with the specified UID. Displays a message to indicate that the entry was updated. This code replaces all of the attributes in a form, without checking whether they are blank. A more complete example would check for blank fields and either require entered data or not include the corresponding attribute in the attributes string. |
  <input type="Submit" name="action" value="Update" tabindex="9"></td> |
Defines the Submit button for the update action. |