[Looking for Charlie's main web site?]

Setting Google to Show You More Results Per Page: how and why

Note: This blog post is from 2009. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
In a recent entry, I made mention of the fact that I have Google set to show me 30 results per page, rather than the default of 10.

Some may read this and say, "big deal, I've been doing that for years", but it's one of those little things that some just never notice or think of. If you've not considered the option, why not check it out?

(Update on 9/30/2010: Others may have noticed that they DID have it set to more than 10, but recently they lost that functionality. I have the solution for that, as well.)

[....Continue Reading....]

Been losing cookies from sites you visit? Fix in FF 3.0.7, and solution for other browsers

Note: This blog post is from 2009. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
If you use Firefox and have found it losing cookies, this will interest you. Even if you don't use FF, and experience the problem on Chrome, IE, Opera, Safari, etc., the root of the problem and a possible manual solution may interest you.

[....Continue Reading....]

Helping Joe Rinehart and his wife Dale

Note: This blog post is from 2009. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
While some may have seen this news in the past weeks, it bears repeating for some who may have missed it. Joe Rinehart's been a stalwart member of the CF community for some years, known most perhaps for his work on the Model-Glue framework.

Well, sadly, his wife Dale has been diagnosed with Multiple Sclerosis, something he's made public on his blog. In addition to his sharing his experience there, she's has been journaling her experience and emotions on their blog. I'm sure many are finding comfort in their incredible strength and fortitude in the face of such a trying experience.

Still, the costs for treatment will be monumental, and so a group of CF community members have gotten together to create a site, www.helpsupportjoeanddale.com offering a way for those interested to offer donations to help offset those costs. So far the collections have been going really well, and all the money goes to them directly.

You can even watch a short video at the bottom of the page where Joe and Dale express their appreciation for this outpouring of support. All this was a surprise for them, and it's been a touching testament to the greatness of this community. I wanted to wait a couple of weeks to put the news out there again for those who may have missed it the first time.

Recap of the 40 Online CF Meetup talks for 2008

Note: This blog post is from 2009. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
As many in the CF blogosphere reflect on the past year, I figured I'd follow suit with a recap of the 40 talks we've had in 2008 on the Online ColdFusion Meetup. you can find the title and links to descriptions and/or the recordings for each talk below.

[....Continue Reading....]

Wanna a new feature/fix in CF? Report it on the CFWISH form...just don't search for it by that name

Note: This blog post is from 2008. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
Update:
Since writing this blog entry in 2008, Adobe has now opened up access to bug tracking for both CF and CFBuilder. So rather than use the old "wish form" below (which still works but does not give you a tracking number), use instead:

CF Bug Tracker (or also at adobe.com/go/cf_bugs)

Besides giving you a tracking number, you can also search these bug bases, as well as vote and comment on bugs offered by others. Finally, if Adobe addresses your bug, you'll be notified by email of that.

Many may know that Adobe has long offered a Feature Request/Bug Report Form form (which came really from Macromedia, and perhaps even Allaire), but for those who don't, I wanted to mention it here, for a couple of reasons.

[....Continue Reading....]

Kids these days, rowdy like it's 19... um, 399 AD

Note: This blog post is from 2008. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
A teacher relates how he moved to a new city because he heard the students there were much less rowdy than in his former school, where they would just bust in and be disruptive. Of course, we take it as a given that this could happen in many places today, but what's interesting is this isn't an account from today, or yesteryear. Not 100 years ago, nor even 1,000 years ago, but the late 4th century AD!

Here's what he had to say (and how we can relate):

[....Continue Reading....]

Adam Lehman in car accident in London, recovering

Note: This blog post is from 2008. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
I just heard news of this on a private list and when searching could find only one entry with confirmation and a few details, so I wanted to pass the news along, in case others hadn't heard. Thankfully, it ends on a relatively encouraging note, considering the circumstances.

According to Mark Drew, who wrote the entry above, Adobe ColdFusion evangelist Adam Lehman was hit by a car Friday night in London, suffering a broken arm and leg. Mark went with him to the hospital, and reported that he'd had surgery on the arm and was due to have it today for the leg.

Mark added, "Hopefully he will be out in a week or two. Even through this, he has managed to Twitter and update his status. So he is doing OK, if a little out of it due to the pain killers."

That's encouraging news and of course we all wish Adam a speedy recovery.

Adobe announcement: ColdFusion 6, 7, and the end of life of Java 1.4

Note: This blog post is from 2008. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
Some folks may have missed that Adobe released a technote yesterday that may interest some folks. The good news is that there's no bad news--but you should be aware of the news so that when rumors start running rampant, you'll have information from the source.

Old News, coming to fruition next month: Sun EOL of J2SE 1.4. Adobe's response

Sun has previously announced (in 2006) that J2SE 1.4 (the JVM that happens to underlie CF 6 and 7) would reach end of life in October 2008.

Well that's next month, and Adobe has offered a technote to explain how this affects CFers on 6 and 7 (they don't mention 6, as it's no longer formally supported).

  • Adobe will continue to provide support for configurations requiring this version of the J2SE on a best-effort basis
  • Folks can of course upgrade to CF8, which runs on Java 1.6 (and supports 1.5)
  • FWIW,folks running JRun can also upgrade to later versions of it that support later versions of the J2SE

All that's good news, really, so nothing to get excited about.

Java SE for Business

Sun themselves have also addressed the problem by releasing something called Java SE for Business, which extends the life considerably (up to 15 years), which an organization can license. Adobe has said in the technote that they will be supporting that as well.

So the sky is not falling

All this means that if you hear anyone start some rumor that the EOL of Java 1.4 spells some doom for CF 6 or 7, nip it in the bug. Point them at this technote.

As further testament to why this is not a significant issue, Adobe also makes note there that "Servers running ColdFusion MX 6.x with J2SE 1.3.1 or JRun 4 with J2SE 1.3.1 have historically run without problems long after Sun Microsystems had End of Lifed that J2SE version."

More questions

I imagine some reading this will have questions. I'll say right now that I know nothing more than what I read in the technote. I have no inside information. I just thought we ought to call out the technote so folks knew of it.

But ask your questions, and perhaps another reader (or later, I) will have an answer.

PS I'll grant too that maybe this isn't new information (the Adobe response, and this technote). I only caught it today because I get the feed (as I discussed previously) of new/updated technotes. The technote says it was updated yesterday. They don't say when they're created, so it's possible the technote came out in the past. I just don't recall seeing it. (I wish they would put dates on them for this reason.)

4 New CF Technotes

Note: This blog post is from 2008. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
I mentioned in a recent entry how you can get a feed of the latest CF technotes and other important Adobe-created CF resources.

If you've not done it yet, let me take a moment to share news of a few that came out on the feed today:

  • Flex Builder 2 RemoteObject calls to ColdFusion 8 CFCs fail - You are unable to connect Adobe Flex Builder 2 RemoteObjects to Adobe ColdFusion 8 CFCs. Flex Builder 2 projects containing RemoteObject calls to ColdFusion 8 fail to connect for the following reasons: You have not entered the proper compiler arguments which point to your ColdFusion 8's services-config.xml and or your ColdFusion server's context root. You have created your Flex Builder 2 project as a "ColdFusion Flash Remot...
  • UtilPagedTempBuffer SqlException error when connecting to MS-SQL (ColdFusion) - When Adobe ColdFusion connects to an MS-SQL database, you may receive the following error: java.sql.SQLException: [Macromedia][SQLServer JDBC Driver]Usage error for UtilPagedTempBuffer: length can not be negative. This issue can occur after you apply a corrupted service pack to SQL. This issue can occur after you apply a corrupted service pack to SQL....
  • Forgotten password and cannot log in to ColdFusion administrator - You have forgotten the Adobe ColdFusion administrator password and cannot log in....
  • Could not find the coldfusion component or interface cfide.adminapi.accessmanager (ColdFusion) - When you install or update Adobe ColdFusion, you receive the following error message: Could not find the ColdFusion component or interface cfide.adminapi.accessmanager. During the installation, you chose to install the CFIDE directory inside an existing CFIDE directory. For example /CFIDE/CFIDE/.During the installation, you chose to install the CFIDE directory inside an existing CFIDE directory. For example...

And since the day I wrote that entry, here are a few others that came out:

  • How to ensure correct UTC Time Conversion for U.S. Daylight Saving Time changes in 2007 (ColdFusion 5) - ColdFusion 5 depends on the operating system to calculate date and time information. The U.S. Daylight Savings Time changes for 2007 will cause incorrect Universal Time Coordinated (UTC) conversions with ColdFusion 5. Note: Support for ColdFusion 5 officially ended on January 1, 2007 -- see www.adobe.com/support...
  • How to import certificates into certificate stores (ColdFusion) - For secure connections to remote servers over SSL, all current versions of ColdFusion require the remote system's SSL certificate to exist in ColdFusion's certificate truststore. This includes any calls from , , , etc. The default truststore is the JRE's cacerts file. This file is typically located in the following places: Server Configuration : cf_root /runt...
  • Solution for Verity Startup Failure with 'DASDOMParser: Fatal ErrorFile' Error (ColdFusion MX and ColdFusion 8) - The ColdFusion Search Server service (Verity) may fail to start with the error: DASDOMParser: Fatal ErrorFile: /{path-to-verity-admin-files}/admin{0-9}.xmlLine: nChar: nMessage: (example: The main XML document cannot be empty) Errors occurred during parsing... This error is generated when trying to start verity from the command line. It may also be found in the {verity-root}/Data/host/log/status.log in the form of: Failed...

I don't think I'll plan to post new entries whenever they come out. Really, one ougjht to just watch the feed for that. This is more a reminder that even in 2 weeks, a good amount of stuff has come out, so you ought to keep en eye on it.

Getting MaxLength Validation to work with CFTEXTAREA Richtext="yes"...busted, but with a workaround

Note: This blog post is from 2008. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
Have you tried to use the maxlength validation with the new CF8 rich text cftextarea? You'll find that it simply doesn't seem to be working, or works inconsistently. I've done some digging and found why it's not working as it should, and I also offer a workaround for you if interested.

Now, some might point out that with CFFORM maxlength validation, you need to remember to set validate="maxlength", and that's true. And you provide a maxlength attribute and value, as well, but neither of those are what I'm talking about. Nor is it about the fact that you have to account for the underlying HTML that's generated. The validation simply doesn't work as it should, as I'll explain.

The root of the problem

Note that I say it doesn't work as it should--I'm not saying it never works. You can actually get it to trigger a maxlength failure, but it's just not working right.

Here's the deal: what's validated is the length of any data that prepopulates the field, not what the user enters into the field. In other words, it doesn't matter what you (or your user) types into the field. That will not be what's checked, but rather what was there initially. Not too useful (and confusing, for sure).

Let me be more explicit: if there's no text prepulating the field (what's between the CFTEXTAREA) or it's less than the maxlength, then the form submission will always pass without error even if you add lots of text to the field. That's certainly not right.

Conversely, if the field is prepopulated with text that exceeds the maxlength, then the form submission will always fail for the length validation, even if you remove enough text that it should pass. Again, all this could be very confusing if you don't understand what's going wrong.

As an aside, not that it matters to this problem, note that you can also prepopulate a CFTEXTAREA with a Value attribute (not something you can usually do with a normal TEXTAREA.)

A simple sample to test with

Here are 2 examples of what I'm describing. You can drop each into a page (it's a self-posting form, so it doesn't matter what you call the file):

<cfform>
Description (up to 10 characters):
<cftextarea name="description" validate="maxlength" maxlength="10" message="Description must be 10 chars or less" richtext="yes" toolbar="Basic"></cftextarea>
<input type="Submit">
</cfform>

If you run this, you'll notice that it will always pass, regardless of what you enter. Why? Because it's prepopulated with nothing, and that passes the validation, regardless of what you type.

On the other hand, the following will never pass validation, regardless of what you enter, because it's prepopulated with something longer than the maxlength:

<cfform>
Description (up to 10 characters):
<cftextarea name="description" validate="maxlength" maxlength="10" message="Description must be 10 chars or less" richtext="yes" toolbar="Basic">1234567890123</cftextarea>
<input type="Submit">
</cfform>

Obviously, none of this is what you would expect. If you've had people complaining about problems, it's no wonder that you'd be really confused.

(And of course, 10 is too low a number for general use, and unless you're doing an update form you wouldn't likely prepopulate your field as I have, but these make it easy to demo the issue.)

Maxlength validation works fine for CFTEXTAREA, as long as it's not rich text

Now, all that said, things will work just fine if you take out the richtext and toolbar attributes. Go ahead and try it. So clearly it's the richtext feature that's busted with regards to maxlength validation.

Why it's not working

I did some digging into the cfform.js file, which is where the code to do validation lives (in /CFIDE/scripts/) and I found the problem. What's passed to that validation code is not what's typed into the rich textarea (which is itself an iframe buried pretty deep in some code that the FCKEditor builds), but rather what's passed is just the HTML form field value, which in this case will be what was entered into the field when it was initialized (when the page is first loaded).

The ultimate solution is that the CF validation process needs to be changed to instead get the length of whatever was entered into the fckeditor control.

From further digging into that, with regard to some FCKEditor info I found, one might conclude it would be impossible. Many have complained about wanting maxlength validation with the control, and folks working on the tool have said it's a limitation the control.

But here's good news: I did still more digging and learned that the CF javascript API for the new ajax controls does indeed provide access to this information! Woo hoo! You can access it via the ColdFusion.getElementValue('thefieldname') method. With that, one can then test its length.

For now, it's just something you need to do manually. I'll offer some code below that presents how to do this.

Don't forget to account for the generated HTML

Before I show the code, take note about your use of any maxlength test in the richtext textarea (whether it's done by CF itself in the future or by using this manual test): you (and your users, and any messages you give them) need to take into account that the rich textarea will have a length that's longer than just what the user sees/types.

Even with just an "x" entered in a richtext textarea, the underlying content created by the control (and as submitted to the form processing) will be surrounded by paragraph tags:

<p>x</p>

So that x would then have a length of 8 chars! Just be careful that if you need to tell them they can enter no more than 100 characters, because you're entering the text into a database column of that size, then you need to make it clear that they won't be able to really type 100 characters. And the more formatting they do, the less space they'll have.

In my code below, I offer an option for the validation error message to show them the text as entered, with the html coding.

An example of some code to check the real value entered

So the answer is in using the ColdFusion.getElementValue method, passing it the name of the textarea field to be validated. Using that, and its length property, we can do the needed test. As a quick example, here's a demonstration where the cfform onsubmit method is called to display the real text entered in the field, and its length. Note that I gave the cftextarea a name of "description", and that's what I name in the getElementValue (note that all Javascript is case-sensitive, from method names, to variable names, to names of fields accessed in code):

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function testlen(){
   var body = ColdFusion.getElementValue('description');
   alert('text=' + body + '\nlength=' + body.length);
}
//-->
</SCRIPT>

<cfform onsubmit="testlen()">
Description (up to 10 characters):
<cftextarea name="description" richtext="yes" toolbar="Basic"></cftextarea>
<input type="Submit">
</cfform>

With this code, whatever value you enter will be displayed, along with its length.

Now, one may point out that an alternative to using OnSubmit on the CFFORM would be to use OnValidate on the CFTEXTAREA. Well, yes and no. It would normally be a good choice, but we will see later that we will want to create a more flexible form of this code, where we will pass in the name of the field, a test length, and optionally a message to display. The OnValidate only let's you name a method to call, without naming arguments. It's designed to automatically pass in the form field value, just like the built-in validation process, but just as that doesn't work with the rich textarea, so too does it not work for this challenge.

A proposed solution to the textarea richtext validation

So with all that as preface, here then is some code I've put together that may help those wanting to do Rich CFTextArea validation. I've designed it so that you can name the field to validate, the length to test, and optionally an error message to display if it fails the validation, along with an option of whether to show the HTML-formatted generated content in the message.

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function testlen(field,maxlen,msg,showval){
   /*
   Validates maxlength for a CFFORM CFTEXTAREA richtext field.
   Created by Charlie Arehart, carehart.org, 8/1/2008
   - field (required): name of rich textarea field on form to validate (case sensitive!)
   - maxlen (required): the maximum length to be permitted for the length of the textarea body (including generated html)
   - msg (optional): a message to be shown to the user, or empty string ('') to show a default message defined as "defaultmsg" below
   - showval (option): if 'yes', will show the actual generated body as part of the message
   */

   var body = ColdFusion.getElementValue(field);
   var defaultmsg = 'The ' + field + ' field must be less than ' + maxlen + ' characters.'
   // test textarea body length    if (body.length > maxlen) {
      // if no message is passed in, create a default one (the onsubmit in cfform seems to require all args be passed, so 3rd arg can't be left out, but an be set to '')       if (msg.length < 1) msg=defaultmsg;
      // show the current value, if requested       if (showval == 'yes') msg=(msg + '\nCurrent value (with HTML) is:\n' + body)
      alert(msg)
      return (false);
   }
}
//--> </SCRIPT>

<!--- note that for the cfform onsubmit, it appears you must specify all args of a called function --->
<cfform onsubmit="return testlen('description',10,'','yes')" >
Description (up to 10 characters, including HTML):
<cftextarea name="description" richtext="yes" toolbar="Basic">12345</cftextarea>
<input type="Submit">
</cfform>

<cfif cgi.request_method is "post">
   <cfdump var="#form#">
</cfif>

The key is in the call in the onsubmit to the testlen function. The comments explain that it takes the 4 arguments I mentioned. In this case, it's calling testlen('description',10,'','yes'), which is testing the "description" field, for a maxlength of 10, and I'm letting the function create the default error message, while I do want it to show the user the formatted value if they get the validation error. If you want to provide your own message, just provide that in the 3rd argument.

Now, you might think that if you want to skip the 3rd argument but privide the 4th, you could just let it be left unspecified, as in testlen('description',10,,'yes'). But for some reason the OnSubmit attribute of CFFORM doesn't like that. So just specify it as '' if you want to set the 4th arg to 'yes'.

Naturally, if you're happy with the default message and you don't want to show the formatted result to the user, you can then leave off both the last 2 arguments, as in testlen('description',10).

Note as well that you want to call the function (in the OnSubmit attribute) using the form "return testlen(...)", as I have. If you don't, then the form would be submitted anyway even if it fails the validation. By using the return, you cause the result of the function to drive whether the submission takes place, and it returns false if the length test fails.

I could make the function still more robust, testing incoming arguments and such, but it will work for most needs as long as you're careful. Again, remember that when you pass in the name the field, it must be the exact same case and spelling of the CFTEXTAREA name.

That's it. I hope it's helpful. Please let me know what you think in comments, whether it helps or if you see a problem, etc.

Let's hope this is addressed in the CF engine

It would sure be nice to see Adobe get this fixed in the engine. I hope this may help. I'll file a bug report pointing back to this for the details. I've already filed it in the LiveDocs as well.

I will say that if this problem remains into the next release, then the MaxLength attribute and validate="maxlength" option should be removed both flagged as unavailable for CFTEXTAREA when richtext="yes".

More Entries

Copyright ©2024 Charlie Arehart
Carehart Logo
BlogCFC was created by Raymond Camden. This blog is running version 5.005.
(Want to validate the html in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting