I have below code in ColdFusion.
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<cfform id="form1" name="form1" method="post">
<cfquery name="config" datasource="config">
SELECT DISTINCT ColumnName
FROM tablename
</cfquery>
<cfinput name="ColumnName"
type="text"
autoSuggest="#valueList(config.ColumnName)#"
typeahead="true"
size="40"
placeholder="ColumnName"/><br>
</cfform>
</body>
</html>
Problem occurs at this line: autoSuggest="#valueList(config.ColumnName)#"
Below are the errors in console. Am I missing anything?
As per official page of Adobe ColdFusion 2016, I will have to download js and css manually for yui from here
Relevant information from the linked article:
YUI and Spry
We have deprecated YUI and Spry libraries in ColdFusion 2016 (Update 3) and removed the following JavaScript libraries:
<cfusion_webroot>\cf_scripts\scripts\ajax\yui
<cfusion_webroot>\cf_scripts\scripts\ajax\spry
<cfusion_webroot>\cf_scripts\scripts\ajax\resources\yui
As a result, the following tags that use the YUI and Spry features would be impacted:
cfmenu
cftree
cftooptip
cfcalendar
cfinput (autosuggest attribute)
cfinput (sourcefortooltip attribute)
cfsprydataset
As a workaround, you can manually download the removed files from the following locations and copy them in ColdFusion's webroot, at the directories listed above.
YUI (Checksum: 827e0f8395d176ac28f46ed5e78004fd)
Spry (Checksum: 750c275c20b291f00c1ba92c855a09d7)
Related
How to get the HTML text box value to show alert message in office share point.
function show(){
alert('test:' + $("#txtPrice").val());
}
After I have deployed the project from visual studio (successful deploy) and I go to my office share point site the alert is not showed. How can I get the text box value?`
Where you Call your show function?
Have you load jQuery library?
You'd better provide more details for your solution.
Update:
The code is fine, make sure the jQuery library is loaded correctly and try to add your site to trust site to check whether you disable JavaScript for your browser.
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script type="text/javascript">
function show() {
alert('test:' + $("#txtPrice").val());
}
</script>
</head>
<body>
<input id="txtPrice" type="text" />
<input type="button" value="Submit" onclick="show();" id="btnCreate" />
</body>
</html>
I am at learning stage in ColdFusion. Now I am trying to execute below code to display variable content by using <cfset> and <cfoutput> tags. I completed my server installation and I am able to login to server with admin credentials. But it executed as normal html page, not getting the result from ColdFusion tags.
Do I need to install anything apart from this?
<!DOCTYPE html>
<html>
body>
<body background="download.jpg">
<cfset name ="swanav"/>
<cfoutput>#name#</cfoutput>
</body>
</html>
A small correction to your code,
<!DOCTYPE html>
<html>
<body background="download.jpg">
<cfset name="swanav" />
<cfoutput>#name#</cfoutput>
</body>
</html>
The code needs to be placed in,
/cfusion/wwwroot
I've tested several pages so far, and it seems that wherever I am attempting to use <CFHTMLHEAD> to add CSS or JavaScript to a CFM page in ColdFusion 11, it will not add it (works fine in CF8).
I read on SO about increasing the "Maximum Output Buffer size" in the Administrator > Server Setttings > Settings from the default valut of 1024KB, but every value I've tried (2048KB, 4096KB, and even the max allowed 999999KB) I get the same result - the content is not included in the <HEAD> tag when the page loads.
Has anyone else run into this and found a solution yet?
Code Sample:
htmlhead.cfm:
<cfif NOT ThisTag.HasEndTag>
<cfthrow message="Missing end tag for custom tag htmlhead." type="HeadWrap" />
</cfif>
<cfif ThisTag.ExecutionMode is "End">
<cfhtmlhead text="#ThisTag.GeneratedContent#" />
<cfset ThisTag.GeneratedContent = "" />
</cfif>
index.cfm:
<cfsilent>
<!---
Data Retrieval, validation, etc. here
--->
<cf_htmlhead>
<style type="text/css">
tr.status-RETIRED td {
color: #800000;
}
tr.status-PENDING td {
color: #008000;
}
</style>
<script type="text/javascript">
$(function(){
$(".options-menu").mouseleave(function(e){
$(this).hide("fast");
})
$(".options-menu-link").mouseover(function(){
$(".options-menu").hide("fast");
$(".options-menu[data-sku='" + $(this).data("sku") + "']").show("fast");
}).click(function(e){
e.preventDefault();
});
});
</script>
</cf_htmlhead>
</cfsilent>
<!---
Custom Tag layout.cfm contains the DOCTYPE declaration, html, head (loads jquery, jquery-ui, css, etc.), and body tags with a header and footer for each page.
--->
<cf_layout>
<!--- Page Content Here (a form, a table, some divs, etc.) --->
</cf_layout>
I've found that in CF11 anything added using a cfhtmlhead call that comes before a cfcontent reset="true" does not get added to the resulting document. Does the cf_layout tag you are calling after your cf_htmlhead contain a content reset?
For example,
<!--- This will not be added under CF11. --->
<cfhtmlhead text="<!-- I'm some content that will only be included in CF10 or lower. -->">
<cfcontent reset="true">
<!--- This will be added under CF11 and lower. --->
<cfhtmlhead text="<!-- I'm some content that will be added in CF11 and lower. -->">
... the rest of your view code ...
<!--- This is a sample of the content you will get under CF11 --->
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>Head Testing</title>
<!-- I'm some content that will be added in CF11 and lower. -->
</head>
<body>
<h1>Page content</h1>
</body>
</html>
I have an test.cfm where I dynamically build a pdf-File and output it with <cfheader> and <cfcontent> to the browser, but I still want the page to load and show "test html":
<CFFILE action="readbinary" file="#expandpath("./test.cfm")#" variable="testcontent" />
<CFHEADER name="Content-Disposition" value="attachment; filename=""test.txt""; charset=utf-8">
<CFCONTENT type="text/plain" reset="yes" variable="#testcontent#">
<CFCONTENT type="text/html" reset="yes" /><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Testdoc</title>
</head>
<body>test html</body>
</html>
(outputting the file itself is just for the example)
Is there a way to accomplish this?
You can't trigger what happens after a download, but you can do it the other way round - load the page you want, then redirect to the file to download using a HTML meta redirect:
<meta http-equiv="refresh" content="5; url=http://domain.com/path/to/download" />
(If necessary, you can use cfhtmlhead to insert that into the relevant part of an existing HTML page.)
The 5 is the number of seconds to wait - setting to 0 will redirect immediately. (When using with other pages, using an instant redirect can cause issues with the back button; should be less of an issue for downloads though.)
I was trying to run this code, and browser ask me to download pdf file which is good, But it was not loading remaining HTML code or you can say I could not see "Thank you Message".
Am I doing something wrong or missing something?
Need your help
<cfheader name="content-disposition" value="attachment; filename=134.pdf"/>
<cfcontent type="application/pdf" file="#ExpandPath( './134.pdf' )#"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Download Now</title>
</head>
Thank you for your interest in downloading
this file. Your download should begin shortly.
Maybe show the 'download will begin shortly' message first as a distinct page, which then redirects (JavaScript or meta tag...) to the .cfm that generates the PDF.
What you're trying to do is load the PDF file immediatly. As stated before you should have a basic HTML Page:
<html>
<head>
<meta http-equiv="refresh" content="2;url=getpdf.cfm?file=123.pdf">
..rest of head
</head>
<body>
Download will begin shortly.
</body>
</html>
This getpdf.cfm?file=123.pdf will be
<cfheader name="content-disposition" value="attachment; filename=134.pdf"/>
<cfcontent type="application/pdf" file="#ExpandPath( './134.pdf' )#"/>
The reason it wont work, is that you browser reads the "headers" and will basically see the file as a PDF file. Like you were downloading a ".pdf". Now you're putting one step in between and let the browser redirect to the PDF download.