Requested scope CLIENT has not been enabled

when I do some Practice about the client variables, have meet this error

 

 

 Requested scope CLIENT has not been enabled

 

searchForm.cfm

 

you can solve this mistake by do this

 

 

put this code in your application.cfc file

 

  <cfset THIS.clientmanagement="yes">

also you can do the following:(this is another method)

check your settings in CF Admin -> Server Settings -> Client Variables

 

<!---


 Filename: SearchForm2.cfm
 Created by: Nate Weiss (NMW)
 Please Note Maintains ÒlastÓ search via Client variables
--->

<!---
  When user submits form, save search criteria in Client variable
--->
<cfif isDefined("FORM.searchCriteria")>
 <cfset CLIENT.lastSearch = FORM.searchCriteria>
 <cfset CLIENT.lastMaxRows = FORM.searchMaxRows>
<!--- if not submitting yet, get prior search word (if possible) --->
<cfelseif isDefined("CLIENT.lastSearch") and
          isDefined("CLIENT.lastMaxRows")>
 <cfset searchCriteria = CLIENT.lastSearch>
 <cfset searchMaxRows = CLIENT.lastMaxRows>
<!--- if no prior search criteria exists, just show empty string --->
<cfelse>
 <cfset searchCriteria = "">
 <cfset searchMaxRows = 10>
</cfif>

<html>
<head><title>Search Orange Whip</title></head>
<body>

<h2>Search Orange Whip</h2>

<!--- Simple search form, which submits back to this page --->
<cfform action="#cgi.script_name#" method="post">

<!--- "Search Criteria" field --->
Search For:
<cfinput name="SearchCriteria" value="#searchCriteria#"
required="Yes"
message="You must type something to search for!">

<!--- Submit button --->
<input type="Submit" value="Search"><br>

<!--- "Max Matches" field --->
<i>show up to
<cfinput name="SearchMaxRows" value="#searchMaxRows#" size="2"
required="Yes" validate="integer" range="1,500"
message="Provide a number from 1-500 for search maximum.">
matches</i><br>
</cfform>
<!--- If we have something to search for, do it now --->
<cfif searchCriteria neq "">
  <!--- Get matching film entries from database --->
  <cfquery name="getMatches" datasource="ows">
  SELECT FilmID, MovieTitle, Summary
  FROM Films
  WHERE MovieTitle LIKE '%#SearchCriteria#%'
  OR Summary LIKE '%#SearchCriteria#%'
  ORDER BY MovieTitle
  </cfquery>

  <!--- Show number of matches --->
  <cfoutput>
  <hr><i>#getMatches.recordCount# records found for
  "#searchCriteria#"</i><br>
  </cfoutput>

  <!--- Show matches, up to maximum number of rows --->
  <cfoutput query="getMatches" maxrows="#searchMaxRows#">
  <p><b>#MovieTitle#</b><br>
  #Summary#<br>
  </cfoutput>
</cfif>

</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值