是否可以使用cfif语句将"Readonly“添加到我的?
我的URL (示例):
http://www.mywebsite.com/folder/page_review.cfm?action=view&rfqID=2例如:
<cfset pageAction="URL.action">
<cfset rfqID="URL.rfqID">
<label>*Sales Engineer:</label>
<cfinput type="text" name="sales_engineer"
value="" class="rfq_text_input"
<cfif pageAction eq "view"> readonly</cfif>/>我的理论认为它不起作用是因为我在输入中运行if语句。但我不知道该怎么测试这个。
发布于 2015-02-04 18:50:25
你不能像这样嵌套标签:
<cfinput etc <cfif>whatever</cfif> >您可以使用一个简单的输入标记来完成这个任务。否则,你就得做这种事。
<cfif whatever>
<cfinput something>
<cfelse>
<cfinput something else>
</cfif>发布于 2015-02-04 19:50:49
如果坚持使用cfinput,则标记具有只读属性。如果要防止用户键入字段,则有条件地将属性文本设置为除空字符串以外的值。
<cfform>
<cfoutput>
<!--- Readonly attribute of cfinput (Read only) --->
<cfinput type="text" name="text" readOnly="#(true)?"ReadOnly":""#" value="read only">
<!--- Readonly attribute of cfinput (editable) --->
<cfinput type="text" name="text2" readOnly="#(false)?"ReadOnly":""#" value="editable">
<!--- HTML input --->
<input type="text" name="text3" #(true)?"ReadOnly":""# value="read only" />
</cfoutput>
</cfform>https://stackoverflow.com/questions/28328950
复制相似问题