ColdFusion Language

10K

Solutions

13

Articles & Videos

3K

Contributors

ColdFusion is a server-side rapid application development platform originally created by Allaire and now sold by Adobe, implementing the dynamic general purpose CFML programming language. The term ColdFusion is sometimes colloquially used to refer to the CFML language (Cold Fusion Markup Language), but can also include discussions of the server software implementation. ColdFusion runs using a customised version of Apache Tomcat. Earlier versions are bundled with JRun.

Share tech news, updates, or what's on your mind.

Sign up to Post

Bootstrap validator trying to validate the form and submit to the database. The validation part works but it does not submit

the link is here https://jsfiddle.net/tsomik1/5cu96c6y/10/
0
Monthly Recap
Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

I am trying to validate using remote options, but it is always validate as failed
<div class="row">
										<div class="col-sm-12 col-xs-12">
											<input type="text" name="userName" placeholder="Username" class="form-control input-lg" required="required" data-bv-remote="true"/>
										</div>
									</div>

Open in new window

 userName: {
                message: 'The username is not valid',
                validators: {
                    notEmpty: {
                        message: 'The username is required and can\'t be empty'
                    },
                    stringLength: {
                        min: 6,
                        max: 30,
                        message: 'The username must be more than 6 and less than 30 characters long'
                    },
                    regexp: {
                        regexp: /^[a-zA-Z0-9_\.]+$/,
                        message: 'The username can only consist of alphabetical, number, dot and underscore'
                    },

                    remote: {
	                    url: '/includes/website.cfc?method=checkusername',
	                    message: {
	                        en_US:  "This usenrame is already taken, please choose another one",
	                    },
	                    data: {
	                        type: 'userName'
	                    },
	                    type: 'POST',
	                    delay: 1000
	                }


                }
            },

Open in new window

<cffunction name="checkusername" output="true" returntype="any" access="remote" returnformat="JSON" >
          <cfargument name="username" required="true" type="string" />
          <!--- set the default value to false --->
          <cfset var emails = StructNew() />
          <cfset emails.valid = "false" />


          <!--- code to check email in system --->
          <cfquery name="findemail" datasource="#request.datasource#">
               select username
               from users
               where username = <cfqueryparam  value="#arguments.username#" cfsqltype="cf_sql_varchar" />
          </cfquery>
          <cfif findemail.RecordCount eq 0>
               <cfset emails.valid = "true" />
          </cfif>
          <cfoutput>#SerializeJSON(emails)#</cfoutput>
     </cffunction>

Open in new window

0
I am looking for a solution that uses CFSCRIPT to remove all text that is surrounded by '<style' and '/style>' including removing the style tags. Can someone show me how I can use something like ReReplaceNoCase to solve this.

For example: if I have text that looks like:

section a <style>here is style to remove</style>section b <style>more style to remove</style>section c

I need the function to return:
section a section b section c

Thank you.
0
I have an invoice form that needs a date field to be formatted with mm/dd/yy . Its currently working on the client side fine but on the server side I have issues with javascript turned off which is the whole reason I'm formatting it this way. The security requirement is for server  side to catch issues if someone is trying to hack the form w/ javascript turned off in firefox.

Here's the code I have for the parameters:
<cfparam name="form.Invoice_Date" default="">

<cfif session.invoiceDataContr.fileError NEQ 2>
<cfset session.invoiceDataContr.Invoice_Date = "#form.Invoice_Date#">
<cfparam name="form.Invoice_Date" default="">

<cfelse>
<cfset session.invoiceDataContr.Invoice_Date = "#session.invoiceDataContr.Invoice_Date#">

Open in new window


form field:
	<cfset myDate = "#form.Invoice_Date#">
<cfset myYear = #DatePart("yyyy", todayDate)#>
	<cfif isValid("usdate", form.Invoice_Date)>
	     <cfset r_myDate = "20#right(form.Invoice_Date, len(form.Invoice_Date)- 6)#">	
		 <cfif r_myDate GT myYear> 
			<cfset #session.invoiceDataContr.errorString# =#session.invoiceDataContr.errorString#&" No future dates are allowed. Enter date in MM/DD/YY format.,">
	     <cfelse>			  
			<cfif datecompare(todayDate, myDate, "d") EQ -1> 
				<cfset #session.invoiceDataContr.errorString# =#session.invoiceDataContr.errorString#&" No future dates are allowed. Enter date in MM/DD/YY format.,">
			</cfif>			 
		</cfif>       
	<cfelse>
		<cfset #session.invoiceDataContr.errorString# =#session.invoiceDataContr.errorString#&" The Invoice Date is required. No future dates are allowed. Enter date in MM/DD/YY format.,">
	</cfif>	

Open in new window


hidden field:
<input type="hidden" name="Invoice_Date" id="Invoice_Date" value="#HTMLEditFormat(session.invoiceDataContr.Invoice_Date)#">

Open in new window


Its giving me an internal server error when I put the date in as: 4/2/17.

The cf application error log is returning:

The 2 parameter of the Right function, which is now 0, must be a positive integer The specific sequence of files included or processed is: D:\inetpub\wwwroot\**********\**********_verify.cfm, line: 127

It's working for most everything else but this isn't being caught. Before its suggested to use mm/dd/yyyy I can't do that. Specific requirement which is really screwing things up or this wouldn't be an issue likely.

Thanks for any suggestions.
0
Can I use ReReplaceNoCase or someother javascript function to  remove everything in a string from and including '<style' to '/style>'? What would the function call look like?
0
I have created a bootstrap popup login page . When the client click on the login button it will launch the popup and the client will be asked to either login or register. Once login button is clicked I need to validate the credentials and log them in. If the login is not successful I Need to keep them on the same page and show the error message.

Also   I have 2 options forgot user name and forgot password I need to incorporate that within the same popup so it slides and another form is shown
<li class="login-link"><a href="#" data-toggle="modal" data-target="#myModal">Login</a></li>

<div id="myModal" class="modal fade" role="dialog">
			<div class="modal-dialog">
			    <!-- Modal content-->
			    <div class="modal-content">
			    	<div class="modal-header">
			        	<button type="button" class="close" data-dismiss="modal">&times;</button>
						<h2 class="modal-title">Account Login</h2>
			    	</div>
					<div class="modal-body">
						 <form data-toggle="validator" role="form">
			        	<h3>Welcome to I Drive Smart. Please log-in to access your account.</h3>
			        	<div class="form-group">
			        		<input class="modal-username" type="text" name="firstname" class="form-control" data-error="Please enter name field." placeholder="Username" required="required">
			        			<div class="help-block with-errors"></div>
			        	</div>
			        	<div class="form-group">
			        		<input class="modal-password" type="password" 

Open in new window

0
The following code fails and shows the error output in the title. What the heck is going on? Thanks for considering this.

               <form method="post" enctype="multipart/form-data">
                        Select a file:
                        <input type="file" name="fileUpload">
                        <input type="submit" value="Upload File">
                  </form>  
                 
                  <cffile action="upload"
                  accept = "application/pdf,application/msword"
                  filefield="fileUpload"
                  destination="e:\wwwroot\cmis\cmisfiles\security\upload\"  
                  result="FileUploadedYes">

                          <cfdump var="#FileUploadedYes#">
0
I waste lots of time trying to figure out why an insert or update query in ColdFusion is not working.

I typically write code that loads a database table from some other database table.  

It works fine for the first few records, but then I get an error.

I'm loading maybe 15 to 20 columns of data for each record.

What I have been doing is eliminating one column at a time, until I find the piece of data that was not fitting.

Is there a faster way to do this?  

Should I put the query into SQL Server Mgt Studio?  But then I have to copy and paste each bit of data I want to store?

I just can't afford to be this inefficient.  

Hope you can help
0
I have a coldfusion query and I need to search the query by the address with the proximity of 5 miles. The client type their home address and I need to show desired location in the radius of 5 miles
0
I have a coldfusion application running with msql Server 5.7 and windows 7.  While the application works correctly, I am unable to backup the database office_18.sql. The error message is shown below.

I have the same application working on two other pcs which run Windows 10. The backup work in these instances

Is there a known window7  problem in this area and if so, a workaround ?

thanks for any help

james

Environment
windows 7
Coldfusion
Mysql Server 5.7
Application works


CODE
<cftry>  
   <!--- Increase timeout to account for db size. Larger db's require more time for backup --->
   <cfexecute name='C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqldump.exe'
      arguments=" -uroot -pBuddyholly_69 office_18"
      errorVariable="errorMessage"
      outputFile="C:\mysql_backups\office_18.sql"
      timeout="120" />  
	
      <!---errorMessage = <cfoutput>#errorMessage#</cfoutput><br>--->
      <cfdump var="#GetFileInfo('C:\mysql_backups\office_18.sql')#">
      <strong>Votre sauvegarde 1 a reussi</strong> C:\mysql_backups 
	
<cfcatch type="any">  
         <span class="style1"><strong>Votre sauvegarde 1 a echoue</strong></span> C:\mysql_backups  
<cfdump var="#cfcatch#">  
      </cfcatch> 
</cftry> 

Open in new window




error message
Cannot run program "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqldump.exe": CreateProcess error=2, Le fichier spécifié est introuvable
0
DevOps Toolchain Recommendations
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Hello, I have some ColdFusion code that runs when the user presses a button. I am using: <cfif structKeyExists(form, "btnRuleCode")> .....code here....</cfif>

My problem is, I need to add a confirmation that pops up when they click the button, so that the user will see a confirmation that pops up before allowing this code to run, or cancel it. I know how to do this with javascript, but I don't know how to stop it from creating that stuctKey when they press the button. Does this make sense? Can anyone assist?

Thank you.
0
I have a form w/ several fields...one of the fields requirements states: The Contract Number is required and can contain no more than 22 alphanumeric characters. This can't contain spaces however:

here's the current regex setup:

	, Contract_Number: {
				required: true
			   ,pattern: /^[DdFfGgHhNnVv][A-Za-z0-9]*$/

Open in new window


Does anyone have any suggestions on how to modify this?
0
Hi all,

First off thanks for taking the time to look at my concern. Second, I'm a relative newbie to CF, so if it seems like I'm asking the wrong questions, I probably am...

If I cfset application.PropertyName = Property, and then cfdump the application scope, that property appears as expected with the correct value. For example:
<cfif isDefined(form.campaign) AND len(form.campaign) >
        <cfset application.campaign = form.campaign />
    <cfelse>
        <cfset application.campaign = 'default' />
</cfif>
<cfif isDefined(form.channel) AND len(form.channel)>
        <cfset application.channel = form.channel />
    <cfelse>
        <cfset application.channel = form.channel/>
</cfif>
<cfdump var="#application#" />
<cfabort />

Open in new window


renders the form.campaign and form.channel properties properly as application properties.

However, if I cflocation="/path"  to another view after doing so, and cfdump="#application#" again, those properties are no longer available.

This *seems* to be a weirdness regarding Mura, but I'd happily be corrected.

While trying to find out anything I can about this, I stumbled upon the Mura docs for their own scope object, the Mura scope. Is this intended to take the place of Application scope within the context of their framework?

Many thanks.
0
what is wrong with this ?
<CFQUERY datasource="#Application.dsn#" name="addProduct">
                INSERT INTO productsHistory
                (
                  code,commercialname,web,category,description,topnote,middlenote,bottomnote,flashpoint,DEP,vanillin,strength,
                  weightOne,weightTwo,weightThree,weightFour,weightFive,SkinSafe,Soy,SoyRate,Parafin,
                  ParafinRate,Melt,MeltPourRate,Gel,GelRate,ColdPress,ColdPressRate,WaterSoluable,vanillin_status,releaseDate
                 )
                 VALUES
                 ( <cfqueryparam value="#code#" cfsqltype="cf_sql_varchar" maxlength="25">,
                    <cfqueryparam value="#commercialname#" cfsqltype="cf_sql_varchar" maxlength="255">,
                    <cfqueryparam value="#web#" cfsqltype="cf_sql_varchar" maxlength="5">,
                    <cfqueryparam value="#category1#" cfsqltype="cf_sql_varchar" maxlength="100">,
                    <cfqueryparam value="#description#" cfsqltype="cf_sql_longvarchar">,
                    <cfqueryparam value="#topnote#" cfsqltype="cf_sql_varchar" maxlength="50">,
                    <cfqueryparam value="#middlenote#" cfsqltype="cf_sql_varchar" maxlength="50">,
                    <cfqueryparam value="#bottomnote#" cfsqltype="cf_sql_varchar" maxlength="50">,
                    <cfqueryparam value="#fp#" cfsqltype="cf_sql_varchar" maxlength="25">,
                    <cfqueryparam value="#dep#" cfsqltype="cf_sql_varchar"
0
Hi,

I need your help please,

This is what I currently have 
<cfset SpreadsheetAddRow(sObj,"GROUP PRPR ID,GROUP NAME")>

Open in new window


but

This is what I want 
<cfset SpreadsheetAddRow(sObj,"GROUP PRPR ID" & <cfif isdefined('form.GroupName')> ",GROUP NAME" </cfif>")>

I want to be able to say if the Group Name is available then display it. 

Open in new window



Thank you for your help
Lulu
0
Here's the code I'm using:

				jQuery.validator.addMethod(
		"money",
			function(value, element) {
				var isValidMoney = /^(\d+|\d{1,3}(,\d{3})*)(\.\d{2})?$/.test(value);
				if(isValidMoney) {
					var testValue = value;
					testValue = testValue.replace(",","",-1);
					if(testValue <= 0){
						isValidMoney = false;
					}
				}
				return this.optional(element) || isValidMoney;
			},
			"Insert"
		);

Open in new window


			}
			, Invoice_Amount: {
				  required: true
				, money: true
				, pattern: /^\d+\.\d{0,2}$/
				, min: .01
			}

Open in new window


Won't catch where I need it to. Anyone see where this would be failing?
0
HI

I need to create a number of pdf reports using a pdf layout as the background and add data into the areas on the doc,

This is easy in cold fusion using cfdocument, i need to do this in c# asp.net, can anybody give me advise.

thanks

stu
0
I need to create map using google map API. I have created a map by the page load.

Also i have filters search by location, search by state, and the school and the search button. So what I need when the user click on the search the appropriate parameter to be send to the query and once the query returns the result place markers on the map. Once marker get clicked display the info from the query
0
Code below I need to merge cells to prevent the "help" bubble from moving to the next line when the window is scaled down...not taking:
<tr>
                        <td>
                        	<font face="Arial" size="2" color="#990000">
                            <label for="Contract_Number">Contract Number:&nbsp;</label>
							 <input type="text" name="Contract_Number" id="Contract_Number" minlength="8"  maxlength="22" tabindex="7" value="<cfif structkeyexists(session.invoiceDataContr, "PASS")><cfoutput>#session.invoiceDataContr.Contract_Number#</cfoutput><cfelse><cfoutput>#form.Contract_Number#</cfoutput></cfif>" required/>
                        	<font size="1" color="navy" title="No hyphens or special characters, OF-347 block 2, SF-26 block 2, SF-1442 block 4, SF-1449 block 2, SF-33 block 2">(help)</font></font>
                        </td>
                      <td width="23%">

                        <font face="Arial" size="2" color="#990000"><label for="Invoice_Date">Invoice Date:&nbsp;</label>
                        <input  id="Invoice_Date"  name="Invoice_Date"  size="15" maxlength="8" class="theDatePicker" type="date"  tabindex="8"  value="<cfif structkeyexists(session.invoiceDataContr, "PASS")><cfoutput>#session.invoiceDataContr.Invoice_Date#</cfoutput><cfelse><cfoutput>#form.Contract_Number#</cfoutput></cfif>" required/>
                        <font face="Arial" size="2" color="#990000"><font size="1" color="navy" title="Format MM/DD/YY, No 

Open in new window

0
The Orion Papers
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Lucee version 5.1.3.18
Ubuntu Linux 16.04.1
MS SQL Server 2014

Hello, friends,

I have been struggling with this task for several days and it's time I asked for some help.

In brief: I moved my CFML application from Adobe ColdFusion to Lucee, and now the application no longer uploads documents to my web server.

Details:

This application, created in 2010 with considerable and very patient help from gdemaria and _agx_, is just a form that allows the user to create a database record (a document) and upload one or more files to associate with the record.

Last week I moved this code to the Lucee CFML processor. Lucee processes the form partially. It uploads the document thumbnail image -- around line 48 -- right at the start of the doSave action. Then, the form goes directly to the cflocation URL, without doing anything else. No database records are created when the form submits; no files are uploaded.

There's no error message. Lucee is finicky about the code it processes, so I am thinking there is something here that Lucee objects to. I am just not sure what it is.

I would like to DUMP out the variables to see if Lucee is stumbling on any variables -- but I am not sure where to place the CFDUMP. Or what the CFDUMP should test for.

For example:

<cfdump var="#DocumentID#">
<cfabort>
   
But I am not sure that I want or need to test for variable DocumentID.

The application code is below; I have tidied it as much as I can before presenting it here.…
0
Have 2 tables-members and attendance, both related by memberid. Need to be able to show all members in 1 column, dates of attendance in several columns with attendance results for each date in columns next to member name. Table layout would be as follows

Members Attending By Date
<table width="98%" border="0" cellspacing="3" cellpadding="3">
  <tr>
    <td width="19%">&nbsp;</td>
    <td width="13%">Date</td>
    <td width="13%">Date</td>
    <td width="12%">Date</td>
    <td width="15%">Date</td>
    <td width="13%">Date</td>
    <td width="15%">Date</td>
  </tr>
  <tr>
    <td width="19%">person</td>
    <td width="13%">Y</td>
    <td width="13%">Y</td>
    <td width="12%">N</td>
    <td width="15%">Y</td>
    <td width="13%">N</td>
    <td width="15%">Y</td>
  </tr>
  <tr>
    <td width="19%">person</td>
    <td width="13%">N</td>
    <td width="13%">N</td>
    <td width="12%">Y</td>
    <td width="15%">Y</td>
    <td width="13%">Y</td>
    <td width="15%">Y</td>
  </tr>
  <tr>
    <td width="19%">person</td>
    <td width="13%">Y</td>
    <td width="13%">Y</td>
    <td width="12%">Y</td>
    <td width="15%">Y</td>
    <td width="13%">Y</td>
    <td width="15%">Y</td>
  </tr>
  <tr>
    <td width="19%">person</td>
    <td width="13%">Y</td>
    <td width="13%">Y</td>
    <td width="12%">Y</td>
    <td width="15%">Y</td>
    <td width="13%">Y</td>
    <td width="15%">N</td>
  </tr>
</table>
Really not sure how to go about …
0
In our program our clients are uploading PDF's from an IPad and each time they do it we get an error of

No data was received in the uploaded file *name of document*
Saving empty (zero-length) files is prohibited.
Verify that you specified the correct file.

The clients see that there was an error so they upload the document again and the document gets uploaded.
So they need to attempt to upload the document 2 times. The first time it always errors out and the 2nd time it gets uploaded.

I am not sure what is going on and I am unable to replicate this error my self. I don't know if anyone has any ideas of how to fix this.
Here is the code that is doing the uploading
<cffile action="upload"
		  filefield="Test"
		  destination="#ExpandPath("./residentfiles8/")#"
		  nameconflict="makeunique">
           <cfif (CFFILE.FileSize GT (10500 * 1024))> <!-- check if the file size is less than 10MB-->
          	<cfset toBig=1>                     
            	<cffile  action="DELETE" file="#ExpandPath('./residentfiles8/#CFFILE.ServerFile#')#" />         <!-- if to big delete file -->                            
            <cfelseif ListFind( "pdf,txt,doc,docx", LCase(CFFILE.ServerFileExt) )><!--check to see if valid file extensions -->
            	<!-- file less than 10MB save the date and proper file extensions -->
            		<cfset toBig=0>             	
			<cfelse><!-- if file extensions are not valid -->                
                    <cffile  

Open in new window

0
I need to perform cf dump of a browse to select a pdf field? How do I do that?

<cfdump>  ?  </cfdump>
0
I am trying to connect to the FitBit API and in order to get access and refresh tokens, I must first obtain and Authorization Code. Currently, I am sending users to the FitBit supplied URL that redirects back to my app's index.cfm page with a URL argument appended. However, using this method send my app into an infinite redirect loop.

Sample code:
<cfhttp url="https://www.fitbit.com/oauth2/authorize?response_type=code&client_id=XXXX&redirect_uri=http%3A%2F%2Fwww.myapp.com%2Ffitbit%2Findex.cfm&scope=activity%20heartrate%20location%20nutrition%20profile%20settings%20sleep%20social%20weight&expires_in=60" result="code" method="GET">
</cfhttp>

Open in new window


Is is possible to use a <cfhttp> request programmatically and grab the URL code returned from the FitBit server? If I output the result attribute named "code" in the example above, it returns the full HTML of the page.
0
In Mura 6, displaying the summary was as simple as the following;

#$.dspBody(body=$.content('summary'),pageTitle='',crumbList=false,showMetaImage=false)#

Open in new window


In Mura 7, that line of code displays the body, rather than the summary...  There is yet no documentation for Mura 7.  Has anyone discovered the secret of rendering a pages summary?
0

ColdFusion Language

10K

Solutions

13

Articles & Videos

3K

Contributors

ColdFusion is a server-side rapid application development platform originally created by Allaire and now sold by Adobe, implementing the dynamic general purpose CFML programming language. The term ColdFusion is sometimes colloquially used to refer to the CFML language (Cold Fusion Markup Language), but can also include discussions of the server software implementation. ColdFusion runs using a customised version of Apache Tomcat. Earlier versions are bundled with JRun.