Select The Correct Equipment
We use an open source software package called GLPI to track our equipment and the trouble tickets associated with them. A while back I had built a ASP.net front end for our end users to enter their own trouble tickets. Since the database is populated with every computer, printer and phone in the company there was a simple little interface that allowed them to select a radio button for say printer and then a drop down box would appear with all the printers in the company with the printer’s location for them to select the printer that is having the issue.
The problem came into the fact that I thought people would be conscientious enough to actually select the device that was actually having the problem. This was not the case. Instead all the trouble tickets were being generated for the first piece of equipment in the corresponding list. A bit frustrating as we would then have to drop into the database and change the association between the ticket to the correct equipment.
This needed to stop so here is how I did it.
First off I changed the SQL query to add one more select option to the top of the list of options they could choose from. For the printers the query now looked like this for the printers:
SELECT * FROM
(SELECT id,
CONCAT(name,' { ',comments,' } ') AS name
FROM glpi_printers
WHERE deleted = 0
AND is_template = 0
AND name <> 'shelf'
UNION ALL
SELECT 0,
'--SELECT A PRINTER--'
) as t1
ORDER BY
name;
This now adds the option –SELECT A PRINTER—at the top of the list with an ID value of 0.
Next I add a CompareValidator control to the drop down list that displays the equipment listing.
<asp:CompareValidator ID="cvDevice" runat="server" ControlToValidate="ddlSelectedDevice" ValueToCompare="0" type="Integer" operator="GreaterThan" ErrorMessage="<br /><strong>You must select a valid device for support!</strong>" display="Dynamic" SetFocusOnError="True" />
Now when they create a ticket if they skip over the dropdown list for the equipment, they will get a message telling them to select a valid device. While this does not guarantee that they will actually choose the equipment that is in need of support, I have a better chance at getting the correct equipment selected.