root/trunk/website/soundings/handlers/textbox/edit.cfm

Revision 5, 2.8 kB (checked in by DanWilson, 17 years ago)

Initial Commit Of ModelGlue? Website (upgrade to blogcfc 511)

Line 
1<cfsetting enablecfoutputonly=true>
2<!---
3        Name         : handlers/textbox/edit.cfm
4        Author       : Raymond Camden
5        Created      : September 17, 2004
6        Last Updated : October 7, 2005
7        History      : try/catch
8        Purpose          : Supports Textbox
9--->
10
11<cfparam name="attributes.multi" default="false">
12
13<cfif isDefined("attributes.question")>
14        <cfparam name="form.question" default="#attributes.question.question#">
15        <cfparam name="form.rank" default="#attributes.question.rank#">
16        <cfparam name="form.required" default="#attributes.question.required#">
17<cfelse>
18        <cfparam name="form.question" default="">
19        <cfparam name="form.rank" default="#attributes.toprank+1#">
20        <cfparam name="form.required" default="false">
21</cfif>
22
23<cfif isDefined("form.save")>
24        <cfset form = request.udf.cleanStruct(form)>
25        <cfset errors = "">
26
27        <cfif not len(form.question)>
28                <cfset errors = errors & "You must enter a question.<br>">
29        </cfif>
30       
31        <cfif form.rank is "" or not isNumeric(form.rank) or form.rank lte 0>
32                <cfset errors = errors & "Rank must be 1 or above.<br>">
33        </cfif>
34                       
35        <cfif not len(errors)>
36                <cftry>
37                        <cfif not isDefined("attributes.question")>
38                                <cfset application.question.addQuestion(form.question, form.rank, form.required, attributes.surveyidfk, attributes.questionType.id)>
39                        <cfelse>
40                                <cfset application.question.updateQuestion(attributes.question.id,form.question, form.rank, form.required, attributes.surveyidfk, attributes.questiontype.id)>
41                        </cfif>
42                        <cfset msg = "Your question has been saved.">
43                        <cflocation url="questions.cfm?surveyidfk=#attributes.surveyidfk#&msg=#urlEncodedFormat(msg)#" addToken="false">
44                        <cfcatch>
45                                <cfset errors = cfcatch.message>
46                        </cfcatch>
47                </cftry>
48        </cfif>
49       
50</cfif>
51
52<cfoutput>
53<p>
54Please use the form below to edit the TextBox question.
55</p>
56
57<p>
58<cfif isDefined("errors")><ul><b>#errors#</b></ul></cfif>
59<form action="#cgi.script_name#?#attributes.queryString#" method="post">
60<table cellspacing=0 cellpadding=5 class="adminEditTable" width="100%">
61        <tr valign="top">
62                <td width="200"><b>(*) Question:</b></td>
63                <td><input type="text" name="question" value="#form.question#" size="50"></td>
64        </tr>
65        <tr valign="top">
66                <td><b>(*) Rank:</b></td>
67                <td><input type="text" name="rank" value="#form.rank#" size="2"></td>
68        </tr>
69        <tr valign="top">
70                <td><b>(*) Required:</b></td>
71                <td>
72                        <input type="radio" name="required" value="true" <cfif form.required>checked</cfif>>Yes<br>     
73                        <input type="radio" name="required" value="false" <cfif not form.required>checked</cfif>>No<br>
74                </td>
75        </tr>
76        <tr>
77                <td>&nbsp;</td>
78                <td><input type="submit" name="save" value="Save"> <input type="submit" name="cancel" value="Cancel"></td>
79        </tr>
80</table>
81</form>
82</p>
83
84</cfoutput>
85
86<cfsetting enablecfoutputonly=false>
87
88<cfexit method="exittag">
Note: See TracBrowser for help on using the browser.