Skip to main content
Participating Frequently
September 21, 2009
Question

Display #value# from database in field

  • September 21, 2009
  • 2 replies
  • 650 views

(Simplified example - feel free to ask for more info)

I've got a cf application which displays a summary page

<cfoutput query="summaryInfo">

     Times: #timeFormat(bookingStart, "hh:mm")# - #timeFormat(bookingEnd, "hh:mm")#

     Notes: #notes#

     Replies: #replies#

</cfoutput>

This all works fine. As well as a table of bookings, there is a table of replies for ease of use (select the replies you want from a list, then edit and add free text). [e2a - these replies are then saved in the db as the #replies# field above [/e2a] This works fine too.

My problem is this:

I've got one reply which is

     "Please be available at #bookingStart# for instruction"

i.e. I potentially have the above table showing

     Times: 8.30-9.30

     Notes: Stuff to do

     Replies: Please be available at #bookingStart# for instruction

Ideally I'd like the #bookingStart# to automatically detect what this time is.

The more I think about this the more I wonder why I don't get an error for having # 's in the replies field.

    This topic has been closed for replies.

    2 replies

    BKBK
    Community Expert
    Community Expert
    September 26, 2009
    Please be available at #bookingStart# for instruction

    In my opinion, you shouldn't find a workaround for this, but the cause and the solution. To start with, it is an error for that line to be in the database.

    The cause and the solution: Retrace your steps back to where the code inserts that line into the database. It is very likely that you mistakenly inserted #bookigStart#, instead of  <cfoutput>#timeFormat(bookingStart, "hh:mm")#<cfoutput>.

    Cyril Hanquez
    Participating Frequently
    September 25, 2009

    Okay, I'm not sure how you are saving the reply field with #bookingStart# which is the problem for me (saving, not displaying). In any case, if you want to keep things like this just do

    <cfoutput query="summaryInfo">

         Times: #timeFormat(bookingStart, "hh:mm")# - #timeFormat(bookingEnd, "hh:mm")#

         Notes: #notes#

         Replies: #Replace(replies,"#bookingStart#",timeFormat(bookingStart, "hh:mm") ,"ALL")#

    </cfoutput>

    Let me know if it's working...