0
私は、これらの4つのフィールド(それぞれ異なる名前&の機能)の約30のインスタンスでフォームデータを処理しています。これをより管理しやすくする方法はありますか?このバグのロジックを最適化するにはどうすればよいですか?
<!--- Lifeguard Instructor --->
<!--- Is the date defined? --->
<cfif len(Trim(form.lifeguardInstrcutorExp)) EQ 0>
<cfinvokeargument name="lifeguardInstrcutorExp"
value="#defaultDate#">
<cfelse>
<cfinvokeargument name="lifeguardInstrcutorExp"
value="#CreateODBCDate(Form.lifeguardInstrcutorExp)#">
</cfif>
<!--- Is a Company defined? --->
<cfif len(Trim(form.lifeguardInstrcutorCompany)) EQ 0>
<cfinvokeargument name="lifeguardInstrcutorCompany" value="">
<cfelse>
<cfinvokeargument name="lifeguardInstrcutorCompany"
value="#Trim(Form.lifeguardInstrcutorCompany)#">
</cfif>
<!--- Has a file been specificed? --->
<cfif not len(Trim(form.lifeguardInstrcutorImage)) EQ 0>
<cffile action="upload" accept="#defaultFileAccepted#"
filefield="lifeguardInstrcutorImage"
destination="#destination#"
nameConflict="makeUnique">
<cfinvokeargument name="lifeguardInstrcutorImage"
value="#pathOfFile##cffile.serverFile#">
<cfelse>
</cfif>
<!--- Do We have a hard copy? --->
<cfinvokeargument name="lifeguardInstrcutorOnFile"
value="#Trim(form.lifeguardInstrcutorOnFile)#">
より多くを知らなくても、それはそう。空の文字列を無視するか、特定の引数のために 'default'を設定するなどの機能をもう少し働かせてください。 '#defaultDate#'とは何ですか? (また、 "会社"のチェックは、トリムを超えて何もしないようです)。 – Leigh
あなたはアイテムを複製している場所とその逸脱箇所を確認するために、pastbin(http://www.pastebin.com)コードの大きなサンプルを入手できますか? – Nate