Jake Churchill

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

  • Home
  • About
  • Projects

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
July 2009
M T W T F S S
« May    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Subscribe to Blog

Your email:

Subscribe   Unsubscribe

Archives

Categories

  • Browsers (3)
  • CFEclipse (2)
  • ColdFusion (5)
  • CSS (9)
  • Farcry (32)
    • 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)

Recent Posts

  • 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

  • jellyBean on Flex Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 200
  • Wouter Meeuwisse on CSS Browser Hacks
  • Jake Churchill on Flex Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 200
  • coulix on Flex Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 200
  • Jake Churchill on IE menu hover fix

Recent Post

  • 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
  • Flex Custom Preloader without SWF
  • IE menu hover fix
  • Eclipse with plugins
  • Flex Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 200
  • Flex Metadata - Default Property Values

Recent Comments

  • jellyBean in Flex Channel.Connect.Failed error NetConnection.Ca…
  • Wouter Meeuwisse in CSS Browser Hacks
  • Jake Churchill in Flex Channel.Connect.Failed error NetConnection.Ca…
  • coulix in Flex Channel.Connect.Failed error NetConnection.Ca…
  • Jake Churchill in IE menu hover fix
  • nwhysel in IE menu hover fix
  • Jake Churchill » Post Topic &… in Flex 2 Datagrid not highlighting row
  • Jake Churchill in Reboot XP PC over Remote Desktop
  • Jake Churchill in IE6 PNG Transparency Fix
  • oomes in IE6 PNG Transparency Fix
© 2008 Jake Churchill is proudly powered by WordPress
Theme designed by Roam2Rome