Jake Churchill

… on Flex, ColdFusion, FarCry, and much more …

  • Home
  • About
  • Projects

2

Feb

ColdFusion VirtualMerchant CFC

Posted by Jake Churchill  Published in ColdFusion

One of the biggest requests I get is to explain how I integrated a ColdFusion app with the VirtualMerchant Gateway. It was actually quite simple. The difficulty lies in the lack of documentation and help from VirtualMerchant. Their gateway does not seem to allow for much customization or control.

If you want to have a user click a button and be sent to VirtualMerchant’s payment terminal for the payment processing, it’s great. But it is more difficult to allow the user to stay on your site and use VirtualMerchant only for the payment processing.

Here’s what I did:


continue reading "ColdFusion VirtualMerchant CFC"

no comment

14

Jul

Delete Mail via POP Script

Posted by Jake Churchill  Published in ColdFusion

I’ve had an issue come up several times in the last month where I’ll get several thousand emails from sites on errors or notifications or whatever. I have no choice but to be on the list to receive the emails and I was sick of trying to manage all of them (most of them just got deleted anyway) so I thought I’d write a script to do the deleting for me. You can see the script below (with certain data such as usernames and passwords removed for privacy):

continue reading "Delete Mail via POP Script"

no comment

8

Apr

ColdFusion Implementation of Virtual Merchant

Posted by Jake Churchill  Published in ColdFusion

CF Webtools works on plenty of e-commerce sites. Some generate only a trivial amount of revenue and others generate millions every year. The most common implementations we see and deal with are authorize.net and paypal. Both have very standard APIs and a feature list that is continuously expanding. Recently I was given a project which required implementing Virtual Merchant into Site Director and Farcry. It also required the ability to use multiple merchants through the same implementation in Farcry. Here’s what I did…


continue reading "ColdFusion Implementation of Virtual Merchant"

no comment

19

Sep

BlogCFC Last ‘n’ Entries

Posted by Jake Churchill  Published in ColdFusion

A question came my way today about Ray Camden’s BlogCFC and I hope I’m not stepping on Ray’s toes by answering it. Someone wanted to know how to configure the default entries that show up. Some of his were dropping off after a certain time frame and he wanted to increase the default time frame. So, here’s how it’s done…

Blog.cfc in org/Camden/blog in the blog’s install folder has a function getEntries() which takes a ‘params’ structure. The ‘params’ structure is passed to the function in index.cfm of your blog instance. Here’s that code:

<cftry>
      <cfset articles = application.blog.getEntries(params)>
      <!--- if using alias, switch mode to entry --->
      <cfif url.mode is "alias">
            <cfset url.mode = "entry">
            </cfset><cfset url.entry = articles.id>
      </cfset></cfif>
      <cfcatch>
            <cfset articles = queryNew("id")>
      </cfset></cfcatch>
</cfset></cftry>


continue reading "BlogCFC Last ‘n’ Entries"

no comment

7

Sep

CFMAILPARAM Sender

Posted by Jake Churchill  Published in ColdFusion

I’m writing this to hopefully allow other people to avoid the issues I’ve had with one of the sites I support. This particular client’s business revolves around sending emails so it is obviously important that the end user receive those emails. Spam filters are more and more getting in the way. One thing you have to really think about when sending the email is “What will this email look like to the receiving server?” If you are on domain.com and you send an email using cfmail and the from address is a domain.com address, there is no problem. It’d be like sending that same message through Outlook using a domain.com address and domain.com relay (SMTP) server.

What if you have a form allowing a random user to send an email?This is where SPF filtering can block your message. They put in their from email address and to email address and whatever other data and that information gets stuck into the cfmail tag. Now, you might have an email address FROM someone@from.com TO someone@to.com. The email was sent THROUGH the domain.com server. Now if to.com’s server acknowledges SPF filtering, it will look at the dns record for from.com and look specifically at the TXT record. A smart DNS entry will list IP addresses that are able to send email. If the IP address of domain.com’s mail server does not appear in the DNS record of to.com, then the message will be blocked.

Here’s an example of the TXT record from domain.com:

domain.com       86400   IN         TXT       "v=spf1 ip4:xx.xx.xx.xx ip4:yy.yy.yy.yy ip4:zz.zz.zz.zz -all"

The first 3 ip addresses would be valid mail servers. The –all says to reject anything that is not one of those 3 ip addresses.

The way around this is to use a cfmailparam tag with a valid email address for domain.com (make an email address if necessary like info@domain.com). Here’s what the resulting code looks like:

<cfmail to="#to#"  from="#from#" subject="#subject#" type="html">
<cfmailparam name="sender" value="valid_email@domain.com">
.
.
.
</cfmail>

I hope this helps some people out

no comment

27

Mar

Generic HTML Form error handler

Posted by Jake Churchill  Published in ColdFusion

The guy I share an office with is a flex developer and often has problems with simple ColdFusion tasks like form error handling because he doesn’t do them enough. Perhaps others deal with the same situation.

Here’s a generic form error handler.

First, add a little snippet to the form display. I always change the form field label to red if the user did not enter data.

<span style="font-weight:bold;color:<cfif ListFindNoCase(form.errorfields, 'email')>red<cfelse>black</cfif>;">Email Address:</span>
<input type="text" name="email" value="<cfoutput>#form.email#</cfoutput>">

You notice the form.errorfields right? That gets generated in the event/error handler code.

// check for errors in form fields
for (i = 1; i LTE ListLen(form.fieldnames); i = i + 1) {
	if (NOT len(trim(form[ListGetAT(form.fieldnames, i)]))) {
		form.errorFields = listAppend(form.errorFields, ListGetAt(form.fieldNames, i));
	}
}

This simply checks to make sure all fields have data. It does not check the validity of that data so you will need to add that yourself. For an email field, add something like:

if (IsValid(“email”, form[ListGetAt(form.fieldnames, i)])

(This is CF7 specific)

One thing to note is that Radio buttons will not show up in the form.fieldnames if there is not a default value. To add them manually do:

form.fieldnames = ListAppend(form.fieldnames, “radioButton”);

If a field is not required, remove it from the list by doing this:

form.fieldnames = listDeleteAt(form.fieldnames, ListFindNoCase(form.fieldnames, “submitButton”));

Once again, this is very generic and can be extended to be much more robust. But, for a simple form, this works great.

no comment

13

Nov

Quick Browser Detection for CSS Script

Posted by Jake Churchill  Published in Browsers, CSS, ColdFusion

Here’s a quick script that I use in a lot of header files to detect the user’s browser. else represents Firefox in most cases.

<cfif Trim(ListGetAt(CGI.HTTP_USER_AGENT, 2, ";")) EQ "MSIE 6.0">
        <link rel="stylesheet" type="text/css" href="css/main_IE6.css" media="screen" />
    <cfelseif Trim(ListGetAT(CGI.HTTP_USER_AGENT, 2, ";")) EQ "MSIE 7.0">
        <link rel="stylesheet" type="text/css" href="css/main_IE7.css" media="screen" />
    <cfelse>
        <link rel="stylesheet" type="text/css" href="css/main_FF.css" media="screen" />
    </cfif>
no comment

Search

Blog Feed

  • Add blog to any reader
  • Comments Rss
May 2013
M T W T F S S
« Feb    
 12345
6789101112
13141516171819
20212223242526
2728293031  

 

May 2013
M T W T F S S
« Feb    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Subscribe to Blog

Your email:

Subscribe   Unsubscribe

Archives

Categories

  • Browsers (3)
  • CFEclipse (2)
  • ColdFusion (7)
  • CSS (9)
  • Farcry (33)
    • Farcry Examples (2)
    • Farcry Users (1)
  • Flash (1)
  • Flex (14)
  • Javascript (5)
  • Life & Fun (3)
  • Microsoft Office (1)
  • Misc (4)
  • Random Posts (1)
  • SQL (2)
  • Uncategorized (2)

Blogroll

  • Axel Jensen
  • Ben Forta
  • Coldfusion Muse
  • Fullasagoog
  • Nicole Rutter
  • Ray Camden
  • Sandy Clark
  • Stillnet Studios

Recent Posts

  • FCKEditor Firefox 3.6 Bug (Year 2010 Bug)
  • ColdFusion using Java for regex replace
  • ColdFusion VirtualMerchant CFC
  • Farcry Navigation Move Permissions
  • Delete Mail via POP Script

Recent Comments

  • James Moberg on FCKEditor Firefox 3.6 Bug (Year 2010 Bug)
  • Jake Churchill on ColdFusion using Java for regex replace
  • Ben Nadel on ColdFusion using Java for regex replace
  • Peter Boughton on ColdFusion using Java for regex replace
  • Peter Boughton on ColdFusion using Java for regex replace

Recent Post

  • FCKEditor Firefox 3.6 Bug (Year 2010 Bug)
  • ColdFusion using Java for regex replace
  • ColdFusion VirtualMerchant CFC
  • Farcry Navigation Move Permissions
  • Delete Mail via POP Script
  • Flex 2 Datagrid not highlighting row (UPDATE)
  • Flex 2 Datagrid not highlighting row
  • Flex Dynamic casting of data
  • Reboot XP PC over Remote Desktop
  • Dynamically instantiate a class

Recent Comments

  • James Moberg in FCKEditor Firefox 3.6 Bug (Year 2010 Bug)
  • Jake Churchill in ColdFusion using Java for regex replace
  • Ben Nadel in ColdFusion using Java for regex replace
  • Peter Boughton in ColdFusion using Java for regex replace
  • Peter Boughton in ColdFusion using Java for regex replace
  • Matthew in ColdFusion using Java for regex replace
  • Matthew in ColdFusion using Java for regex replace
  • Jake Churchill in Flex Channel.Connect.Failed error NetConnection.Ca…
  • Flex Guy in Flex Channel.Connect.Failed error NetConnection.Ca…
  • Dexter in Flex Custom Preloader without SWF
© 2008 Jake Churchill is proudly powered by WordPress
Theme designed by Roam2Rome