Skip to main content
Participating Frequently
November 11, 2009
Question

cfselect with bind truncates leading zero

  • November 11, 2009
  • 2 replies
  • 842 views

Banging my head against this one. I have two cfselect menus using bind. The first one populates the second. It's working fine except for this one wrinkle: the second select menu gets populated with zip codes. If they have leading zeroes (e.g. 02842) the zero gets clipped. The datatype in MySQL is char(5).

If I just throw a regular query on the data and dump it it comes back with the zeroes fine.

Bug? Workaround?

CF8 BTW.

Thanks.

This topic has been closed for replies.

2 replies

Inspiring
November 12, 2009
Participating Frequently
November 12, 2009

Thanks for the link. What a clunker but if it works it works. I'll post either way.

Inspiring
November 12, 2009

Workaround - instead of binding, invoke the method and use the returned query.

Participating Frequently
November 12, 2009

But if I just invoke the method (which I know returns results with the zero respecting the char datatype) doesn't that kill the interactivity between the bound menus? Right now when you select a state from the first menu a list of available delivery areas determined by zip code is returned. So I want to preserve that ability. I don't want to just list every zip in the database. So am I missing some trick with invoke vs bind?

Inspiring
November 12, 2009

Here is an example of related selects without using binds.  http://www.pathcom.com/~bracuk/code/RelatedSelects.htm

It may or may not be appropriate for your situation.  I remember something on these forums a few years back about performance problems if you used this approach with too much data.