Skip to main content
Participating Frequently
August 22, 2006
Question

CFMAIL Question

  • August 22, 2006
  • 1 reply
  • 170 views
I have an email form that asks the user a number of questions. They are not required to answer them all. Whenever one of the questions are not answered, I get the following error:

Element COMPUTER is undefined in FORM.

Here is the code for my email form. How do I avoid getting this error:

<CFMAIL
To="test"
From="Hardware Request"
Subject="Hardware Request Form"
Type="HTML">
<HTML>
<BODY>
<table width="600">
<tr>
<td width="92">Request Info:</td>
<td width="368"><strong>#form.requestinfo#</strong></td>
</tr>
<tr>
<td>Name:</td>
<td><strong>#form.name#</strong></td>
</tr>
<tr>
<td>Title:</td>
<td><strong>#form.title#</strong></td>
</tr>
<tr>
<td>Extension:</td>
<td><strong>#form.extension#</strong></td>
</tr>
<tr>
<td>Department:</td>
<td><strong>#form.department#</strong></td>
</tr>
</table>
<hr />
<strong>Requesting:</strong>
<table>
<tr>
<td width="600">
Computer - <strong><font color="##FF0000">#form.computer#</font></strong>
<br />
     
Description and details on the business need for the item:<br />
     
<strong>#form.computer_desc#</strong>
</td>
</tr>

<tr>
<td width="620">
Software - <strong><font color="##FF0000">#form.software#</font></strong>
<br />
     
Description and details on the business need for the item:<br />
     
<strong>#form.software_desc#</strong>
</td>
</tr>
<tr>
<td width="620">
Training - <strong><font color="##FF0000">#form.training#</font></strong>
<br />
     
Description:<br />
     
<strong>#form.training_desc#</strong></td>
</tr>
<tr>
<td width="620">

Supplies - <strong><font color="##FF0000">#form.supplies#</font></strong>
<br />
     
Description:<br />
     
<strong>#form.supplies_desc#</strong></td>
</tr>
<tr>
<td width="620">
Other - <strong><font color="##FF0000">#form.other#</font></strong>
<br />
     
Description and details on the business need for the item:<br />
     
<strong>#form.other_desc#</strong></td>
</tr>
<tr>
<td width="620"><br />
Comments:
<strong>#form.comments#</strong></td>
</tr>
</table>
</BODY>
</HTML>
</CFMAIL>
    This topic has been closed for replies.

    1 reply

    Inspiring
    August 22, 2006
    I assume that computer is a checkbox. You can either change your form so this element always has a value, or you can change your action page to check for the existence of the variable.

    If you choose the latter, the function you want to use is isDefined. Useage is described in the cfml reference manual. If you don't have one, the internet does.