Simone
01/28/2022, 7:19 PMif (IsDefined("myquery.startDate") ) {
epipko
02/07/2022, 5:21 PM<CFTRY>
<cfstoredproc procedure="UPDATE_PKG.MAIN_P" datasource="#REQUEST.prod#">
<cfprocparam type="In" value=#FORM.sales_order_number# cfsqltype="CF_SQL_INTEGER">
<cfprocparam type="In" value=#FORM.division_id# cfsqltype="CF_SQL_VARCHAR">
</cfstoredproc>
<cfoutput>
<h3 align="left">Success</h3>
<p></p><a href="#CGI.http_referer#">Go Back</a>
</cfoutput>
<CFCATCH TYPE = "Database">
<cfoutput>
Something went wrong :-( Contact your system administrator<br />
#cfcatch.queryError#
</cfoutput>
</CFCATCH>
</CFTRY>
Adam Cameron
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
. Note the http-equiv
... it is the document-level equivalent of the HTTP header mentioned in the previous phase. I think on the whole these days this is a nice to have, and the header in the transmission is enough? Don't quote me on that.
• when being rendered as part of an HTML document (for example), user-originated data must be security- / intended-usage- encoded before it's rendered, so protect from XSS, and to just make sure it's rendered correctly. A benign example would be that if we were using an HTML client now, and if I wanted actual <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
to appear on the screen for you to read, instead of having the browser goes "oh that's info for me", I need to encode it (escape it, basically). So in your CFML view file, never this:
<cfoutput>#someVariable#</cfoutput>
But always:
<cfoutput>#encodeForHtml(someVariable)#</cfoutput>
unless you are actively outputing markup that should be treated as mark-up. This however is generally a pretty rare thing to be wanting to do.
(note: there are other encoding functions to use for different situations in the HTML document, eg: encodeForHtmlAttribute
and encodeForJs
etc. Use the correct one).Mike Vierow
02/11/2022, 11:04 PM<cfquery name="test">select firstname from names order by firstname asc</cfquery>
<cfoutput query="test" group="firstname">
<cfoutput>
#test.recordcount# <!--- total number of people with this first name --->
</cfoutput>
</cfoutput>
Simone
02/13/2022, 3:22 PMvar k = tblviews.viewsID, concat('<a href=<http://localhost:11000/project1/views_view.cfm?849402E6-E905-790C-E0083357100F99CE=849402E7-01A6-D87F-EDF2EBE1F5ADCBF6&viewsID=2922J07C52B45E706494A8B8687C8CB864568AA8906490B09C7C6E48B6BC9E425088BE441&Task=color>>',tblviews.viewsTitle, '<small>(',tblviews.viewsID,')</small></a>') as viewsTitle, tblviews.viewsManager_ContactID, tblviews.EndDate_Scheduled, tblviews.viewsViews_Target, tblsection.sectionName, tblcontact.FirstName, tblcontact.LastName
Formiko
02/15/2022, 2:17 AMFormiko
02/17/2022, 8:22 PMFormiko
02/17/2022, 8:24 PMSimone
02/18/2022, 2:37 PMjohnbarrett
02/20/2022, 1:58 AMjohnbarrett
02/21/2022, 6:09 PMjohnbarrett
02/28/2022, 3:06 AMcomponent {
this.name = "myApplication";
this.applicationTimeout = CreateTimeSpan(0, 2, 0, 0); //2 hours
this.datasource = "cfhawaii";
this.sessionManagement = true;
this.sessionTimeout = CreateTimeSpan(0, 0, 30, 0); //30 minutes
this.customTagPaths = [ expandPath('/myAppCustomTags') ];
function onApplicationStart() {
return true;
}
function onSessionStart() {}
// the target page is passed in for reference,
// but you are not required to include it
function onRequestStart( string targetPage ) {}
function onRequest( string targetPage ) {
include arguments.targetPage;
}
function onRequestEnd() {}
function onSessionEnd( struct SessionScope, struct ApplicationScope ) {}
function onApplicationEnd( struct ApplicationScope ) {}
function onError( any Exception, string EventName ) {}
}
Rick Morayniss
03/03/2022, 9:25 PMjohnbarrett
03/04/2022, 4:15 AM#CreateODBCDate(Now)#
However I get an error, so I know that this is wrong. Any help would be greatly appreciatedjohnbarrett
03/05/2022, 12:27 AM<cfquery name="Insert"> INSERT INTO users(first_name, last_name, date)
VALUE("#form.first_name#", "#form.last_name#", "#CreateODBCDate(Now())#");
</cfquery>
Rick Morayniss
03/07/2022, 2:53 PMNicole Liliana
03/10/2022, 1:08 PMepipko
03/10/2022, 6:04 PMCUSTOMER_ID,DIVISION_ID,STYLE_ID,QUANTITY
AMAZON,YMS,Y15CXWE,31
AMAZON,YMS,Y15CXWE,85
,,,
,,,
,,,
,,,
Question: how can I remove lines with commas ONLY in them?Rick Morayniss
03/11/2022, 9:52 PMMr M
03/19/2022, 2:19 PMSimone
03/19/2022, 8:25 PM<cffunction name="getCorrectAnswer" returntype="any" output="true" hint='Gets the correct answer'>
<cfargument name="questionidfk" type="UUID" required="true">
<cfset var rsQuery=querynew('')>
<cfset var answer = ''>
<cfquery name="rsIdfromQuestion" datasource="#variables.dsn#">
select id
from questions
where questionnaireidfk = <cfqueryparam value="#arguments.questionidfk#" cfsqltype="CF_SQL_VARCHAR" maxlength="35">
</cfquery>
<cfloop query="rsIdfromQuestion">
<cfquery name="rsQuery" datasource="#variables.dsn#">
select correctAnswer,rank,answer,a_id,id,ROW_NUMBER() OVER(ORDER BY id ASC) AS Row
from answers
where questionidfk = <cfqueryparam value="#rsIdfromQuestion.id#" cfsqltype="CF_SQL_VARCHAR" maxlength="35">
AND correctAnswer IS NOT NULL
</cfquery>
<cfset answer = request.udf.ParagraphFormat2(rsQuery.answer)>
<cfreturn answer>
</cfloop>
</cfif>
</cffunction>
epipko
03/24/2022, 9:59 PM\\cf01\d$\DataTables
folder.
Trying it using code below, but it does not work. What am I missing?
<HTML>
<HEAD>
<TITLE>Data Tables</TITLE>
<link rel="stylesheet" type="text/css" href="DataTables/datatables.min.css">
<script type="text/javascript" charset="utf8" src="DataTables/datatables.min.js"></script>
</HEAD>
<table id="table_id" class="display">
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Row 1 Data 1</td>
<td>Row 1 Data 2</td>
</tr>
<tr>
<td>Row 2 Data 1</td>
<td>Row 2 Data 2</td>
</tr>
</tbody>
</table>
</BODY>
</HTML>
Formiko
04/04/2022, 7:33 PMepipko
04/07/2022, 4:14 PM<cfif isJSON(\\server\c$\Temp\returnly_json.txt)>
, I am getting this error: Invalid CFML construct found on line 85 at column 18.
ColdFusion was looking at the following text:
//
. What am I doing wrong?Formiko
04/11/2022, 2:48 AMNikola Mikasinovic
04/12/2022, 12:37 PMFormiko
04/12/2022, 11:11 PMFormiko
04/17/2022, 7:24 PMepipko
04/19/2022, 5:42 PM<cfset x = #dateTimeFormat(lsParseDateTime(DateConvert("UTC2Local", "2021-12-09T15:11:32.273Z")), 'MM/DD/YYYY hh:nn:ss')#>
<cfoutput>#x#</cfoutput>
and getting this:
12/08/2021 111132
How do I convert back to "*2021-12-09T151132.273Z*" format?epipko
04/22/2022, 3:43 PM<cfset jsonData = deserializeJSON(httpResp.fileContent) />
<cfset return_line_items = jsonData.included>
<cfloop array=#return_line_items# index="i">
<cfset line_item_id = #i.id#>
<cfset line_item_type = #i.type#>
<cfoutput>
Line_item_id: #line_item_id#<br />
Line_item_type: #line_item_type#<br />
</cfoutput>
<br />
</cfloop>
, but when I try to get to carrier this way, I am receiving the error: "Invalid collection .... Must be a valid structure or COM object."
<cfif #i.type# EQ "shipping_labels">
<cfloop collection="#jsonData.included#" item="k">
<cfset carrier = #jsonData.included.attributes.[k].carrier#>
<cfoutput>#carrier#<br /></cfoutput>
</cfloop>
</cfif>