| 1 | <cfsetting enablecfoutputonly=true> |
|---|
| 2 | <!--- |
|---|
| 3 | Name : handlers/multiplechoice/save.cfm |
|---|
| 4 | Author : Raymond Camden |
|---|
| 5 | Created : September 21, 2004 |
|---|
| 6 | Last Updated : March 30, 2006 |
|---|
| 7 | History : 255 limit (rkc 10/12/05) |
|---|
| 8 | : tableprefix fix (rkc 3/30/06) |
|---|
| 9 | Purpose : Supports True/False, Yes/No |
|---|
| 10 | ---> |
|---|
| 11 | |
|---|
| 12 | <cfscript> |
|---|
| 13 | /** |
|---|
| 14 | * Returns TRUE if the string is a valid CF UUID. |
|---|
| 15 | * |
|---|
| 16 | * @param str String to be checked. (Required) |
|---|
| 17 | * @return Returns a boolean. |
|---|
| 18 | * @author Jason Ellison (jgedev@hotmail.com) |
|---|
| 19 | * @version 1, November 24, 2003 |
|---|
| 20 | */ |
|---|
| 21 | function IsCFUUID(str) { |
|---|
| 22 | return REFindNoCase("^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{16}$", str); |
|---|
| 23 | } |
|---|
| 24 | </cfscript> |
|---|
| 25 | |
|---|
| 26 | <cfparam name="attributes.answer"> |
|---|
| 27 | <cfparam name="attributes.questionidfk"> |
|---|
| 28 | <cfparam name="attributes.owner"> |
|---|
| 29 | |
|---|
| 30 | <cfparam name="attributes.single" default="true"> |
|---|
| 31 | <cfparam name="attributes.other" default="false"> |
|---|
| 32 | |
|---|
| 33 | <cfloop index="answer" list="#attributes.answer#"> |
|---|
| 34 | <cfquery datasource="#application.settings.dsn#"> |
|---|
| 35 | insert into #application.settings.tableprefix#results(owneridfk,questionidfk |
|---|
| 36 | <cfif not attributes.other or isCFUUID(answer)> |
|---|
| 37 | ,answeridfk |
|---|
| 38 | <cfelse> |
|---|
| 39 | ,other |
|---|
| 40 | </cfif> |
|---|
| 41 | ) |
|---|
| 42 | values( |
|---|
| 43 | <cfqueryparam cfsqltype="CF_SQL_VARCHAR" maxlength="35" value="#attributes.owner#">, |
|---|
| 44 | <cfqueryparam cfsqltype="CF_SQL_VARCHAR" maxlength="35" value="#attributes.questionidfk#">, |
|---|
| 45 | <cfif isCFUUID(answer)> |
|---|
| 46 | <cfqueryparam cfsqltype="CF_SQL_VARCHAR" maxlength="35" value="#answer#"> |
|---|
| 47 | <cfelse> |
|---|
| 48 | <cfqueryparam cfsqltype="CF_SQL_VARCHAR" maxlength="255" value="#left(answer,255)#"> |
|---|
| 49 | </cfif> |
|---|
| 50 | ) |
|---|
| 51 | </cfquery> |
|---|
| 52 | </cfloop> |
|---|
| 53 | |
|---|
| 54 | <cfsetting enablecfoutputonly=false> |
|---|
| 55 | |
|---|
| 56 | <cfexit method="exittag"> |
|---|