Nice workaround, for some reason I thought you didn't have control over
the js side or something weird. Cool.
Sure would be nice to know that CF isn't altering data, eh? FWIW, I've
been using the ajaxCFC module for a long time (to serialize CF objects
into JSON) and haven't run up against the same issue, but I'm not sure
if I've had Yes/No data to deal with.
- Jack
Rick Faircloth wrote:
Just, fyi, Jack and anyone else...
The solution was to put an inline condition into the code:
...spanRight">' + (row[18] ? 'Yes' : 'No') + '</span>...
Works great!
Rick
*From:* jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com]
*On Behalf Of *Jack Killpatrick
*Sent:* Friday, August 07, 2009 2:55 PM
*To:* jquery-en@googlegroups.com
*Subject:* [jQuery] Re: How to maintain data "Yes" or "No" in output...
I do CF dev work, too, but haven't come across this yet, but it made
me curious. I googled "coldfusion yes no serialize json" and it
brought up a few articles about this. Sounds like adding a space after
"yes " and "no " is the workaround some other people used. Ooof.
- Jack
Rick Faircloth wrote:
Thanks for the perspective, Jack.
I just used firebug to check the json values being returned in the
query (ColdFusion)
and, indeed, the data is "true" and "false" instead of "yes" and "no".
I'll have to work something up server-side. Maybe it's the json
formatting that's
doing it. I have set ColdFusion to return the data to the calling
page in json.
Rick
*From:* jquery-en@googlegroups.com <mailto:jquery-en@googlegroups.com>
[mailto:jquery...@googlegroups.com] *On Behalf Of *Jack Killpatrick
*Sent:* Friday, August 07, 2009 1:09 PM
*To:* jquery-en@googlegroups.com <mailto:jquery-en@googlegroups.com>
*Subject:* [jQuery] Re: How to maintain data "Yes" or "No" in output...
If the values are truly the words Yes and No in the db, then it's
probably the library you're using on the server side to prepare the
data for returning for the ajax call. Check the output of that. If
that's still showing the words, it seems odd that they would transform
again on their way to the browser, but maybe just make sure they have
quotes around them (again, seems unlikely).
- Jack
Rick Faircloth wrote:
I've got a MySQL db that contains "Yes" or "No" in char datafields.
When I use $.ajax to bring that into the DOM and output the data via '
+ row[12] + ', for example,
the values are converted to "true" or "false" when output on the screen.
What's the best method of getting "Yes" or "No" as the output instead
of "true" or "false?"
Thanks for any suggestions!
Rick
----------------------------------------------------------------------------------------------------------------------
/"Ninety percent of the politicians give the other ten percent a bad
reputation." - Henry Kissinger/