<!---
editForm.cfm
author: Leon Chalnick, inspired by Ben Edwards' contact manager
params: request.event

Displays contact page-view (data entry form), loaded with contact data retrieved from
the calling event.

Note that the event to execute next (when the form is submitted) is passed to this 
page-view as an argument of the event named submitEvent. The ContactID is included in 
the triggered event, along with the other fields in the form.

A second form at the bottom is used to trigger the deleteContact event.
--->
<cfset contact = REQUEST.event.getArg('contact') />

<cfoutput>
<font color="##FF0000">#REQUEST.event.getArg('message','')#</font>

<table border="0">
<cfform action="index.cfm?event=#REQUEST.event.getArg('submitEvent')#" method="post">
<input type="Hidden" name="ContactID" value="#contact.getContactID()#">
<tr valign="top">
  <td colspan="2">* indicates required field</td>
</tr>
<tr valign="top">
  <td>Name:</td>
  <td><cfinput type="Text" name="FirstName" value="#contact.getFirstName()#" size="25">
      <cfinput type="Text" name="LastName" value="#contact.getLastName()#" size="25" required="Yes" message="Last Name is required">*</td>
</tr>
<tr valign="top">
  <td>Address:</td>
  <td>
      <input type="Text" name="Address" value="#contact.getAddress()#" size="50">
   </td>
</tr>
<tr valign="top">
  <td>City/State/Zip</td>
  <td>
      <input type="Text" name="City" value="#contact.getCity()#" size="25">
      <input type="Text" name="State" value="#contact.getState()#" size="3">
      <input type="Text" name="Zip" value="#contact.getZip()#" size="10">
   </td>
</tr>
<tr valign="top">
  <td>Country:</td>
  <td>
      <input type="Text" name="Country" value="#contact.getCountry()#">
   </td>
</tr>
<tr valign="top">
  <td>Phone:</td>
  <td><input type="Text" name="phone" value="#contact.getphone()#"></td>
</tr>
<tr valign="top">
  <td>E-Mail:</td>
  <td><input type="Text" name="email" value="#contact.getemail()#" size="50"></td>
</tr>
<tr valign="top">
  <td>Login Name:</td>
  <td><cfinput type="Text" name="UserLogin" value="#contact.getuserlogin()#" required="Yes" message="Login name is required">*</td>
</tr>
<tr valign="top">
  <td>Password:</td>
  <td><cfinput type="password" name="UserPassword" value="#contact.getuserpassword()#" required="Yes" message="Password is required">*</td>
</tr>
<tr valign="top">
  <td>Mailing List?:</td>
  <td><input type="Checkbox" name="MailingList" value="true" #iif(contact.getmailinglist(), de("CHECKED"), de(""))#></td>
</tr>
<tr valign="top">
  <td>&nbsp;</td>
  <td>&nbsp;<br>
    <input type="submit" value="#REQUEST.event.getArg('submitLabel','')#">
    <input type="Button" value="Cancel" onclick="location.href='index.cfm?event=#REQUEST.event.getArg('cancelEvent','')#'">
    </td>
</tr>
</cfform>
<tr>
  <td>&nbsp;</td>
  <td>&nbsp;<br>
    <form action="index.cfm?event=promptDelete" method="post">
    <input type="Hidden" name="contactID" value="#contact.getContactID()#">
    <input type="Hidden" name="ID" value="#contact.getContactID()#">
    <input type="submit" value="Delete contact">
    </form>
    </td>
</tr>
</table>
</cfoutput>
<!--- 

<cfset contact = REQUEST.event.getArg('contact') />
<cfset message = REQUEST.event.getArg('message','') />

<h3>Contact Info</h3>

<font color="#FF0000"><cfoutput>#message#</cfoutput></font>

<cfoutput>
<form action="index.cfm?event=#REQUEST.event.getArg('submitEvent')#" method="post">
  <input type="hidden" name="id" value="#contact.getContactId()#"><br>
  First Name: <input type="text" name="firstName" value="#contact.getFirstName()#"><br>
  Last Name: <input type="text" name="lastName" value="#contact.getLastName()#"><br>
  Street: <input type="text" name="street" value="#contact.getAddress()#"><br>
  City: <input type="text" name="city" value="#contact.getCity()#"><br>
  State: <input type="text" name="state" value="#contact.getState()#"><br>
  Zip Code: <input type="text" name="zip" value="#contact.getZip()#"><br>
  <br>
  <input type="submit" value="#REQUEST.event.getArg('submitLabel','')#">
</form>

<form action="index.cfm?event=cancelCreateContact" method="post">
  <input type="submit" value="Cancel">
</form>
</cfoutput>
--->