Jake Churchill

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

  • Home
  • About

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 url.entry = articles.id>
      </cfif>
      <cfcatch>
            <cfset articles = queryNew("id")>
      </cfcatch>
</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
November 2008
M T W T F S S
« Oct    
 12
3456789
10111213141516
17181920212223
24252627282930

Subscribe to Blog

Your email:  
Subscribe Unsubscribe  

Archives

Categories

  • Browsers (2)
  • CFEclipse (1)
  • ColdFusion (5)
  • CSS (8)
  • Farcry (32)
    • Farcry Examples (2)
    • Farcry Users (1)
  • Flash (1)
  • Flex (8)
  • Javascript (4)
  • Life & Fun (3)
  • Microsoft Office (1)
  • Misc (3)
  • Random Posts (1)
  • SQL (2)

Recent Posts

  • Flex Metadata - Default Property Values
  • VPN Network Routing Step-by-Step
  • VPN Connection Route Fix (Windows Vista)
  • VPN Connection Route Fix
  • SQLite Administrator Recommendation

Recent Comments

  • chris on VPN Network Routing Step-by-Step
  • 3of7 on IE6 PNG Transparency Fix
  • chris on VPN Connection Route Fix
  • Jake Churchill on Flex Menu Expanding Over HTML content
  • James on Flex Menu Expanding Over HTML content

Recent Post

  • Flex Metadata - Default Property Values
  • VPN Network Routing Step-by-Step
  • VPN Connection Route Fix (Windows Vista)
  • VPN Connection Route Fix
  • SQLite Administrator Recommendation
  • Flex Graduated Slider
  • Flex Menu Expanding Over HTML content
  • Flex - Modify your default build template
  • Flex calls to Javascript
  • Custom Object Parsing Function

Recent Comments

  • chris in VPN Network Routing Step-by-Step
  • 3of7 in IE6 PNG Transparency Fix
  • chris in VPN Connection Route Fix
  • Jake Churchill in Flex Menu Expanding Over HTML content
  • James in Flex Menu Expanding Over HTML content
  • ron in Flex Datagrid Sorting
  • Jake Churchill » Post Topic &… in Flex calls to Javascript
  • Dan Wilson in Custom Object Parsing Function
  • Jake Churchill in Javascript Popup with graceful fallback
  • Jake Churchill in Farcry Custom Config
© 2008 Jake Churchill is proudly powered by WordPress
Theme designed by Roam2Rome