......
[allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => mxstu [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 2 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> cfquery output duplicatig a cfset variable - Coldfusion Database Access

cfquery output duplicatig a cfset variable - Coldfusion Database Access

I am experiencing a weird duplication of a cfset variable that I am trying to use in a form as a hidden input element. I am dynamically building a table via a cfquery output of records that need to be given a new status when selected. This new status is set as a cfset variable. But this variable is being changed based on how many records are being outputted. If there are five records, my variable newstatus is being sent as a hidden input this way: record 1 newstatus=8 record 2 newstatus=88 record 3 newstatus=888 record 4 newstatus=8888 record 5 ...

  1. #1

    Default cfquery output duplicatig a cfset variable

    I am experiencing a weird duplication of a cfset variable that I am trying to
    use in a form as a hidden input element. I am dynamically building a table via
    a cfquery output of records that need to be given a new status when selected.
    This new status is set as a cfset variable. But this variable is being changed
    based on how many records are being outputted. If there are five records, my
    variable newstatus is being sent as a hidden input this way:

    record 1 newstatus=8
    record 2 newstatus=88
    record 3 newstatus=888
    record 4 newstatus=8888
    record 5 newstatus=88888

    Why is this happening and how can I change it? I know this is not exactly a
    database problem, but I think the database output is affecting this variable.
    Here is the code. The <cfset> and <cfquery> are on the top of the page, and
    the <form> and <output> is done with in a table in the body:



    <cfset newstatus = "8">
    <cfquery name="to_lmc" datasource="storage">
    SELECT r.request_id, r.request_time, r.title, r.author, r.callnum,
    rby.firstname, rby.lastname, rby.LIN, rby.email, r.requestor_id
    FROM (status s INNER JOIN requests r ON s.request_id = r.request_id)
    INNER JOIN requestors rby ON r.requestor_id = rby.requestor_id
    WHERE s.status_id = 6 OR s.status_id = 7
    </cfquery>

    <cfif to_lmc.recordcount gt 0>
    <cfoutput query="to_lmc">
    <tr><form action="item_received.cfm" method="post">
    <td align="center">#request_id#<input name="request_id" type="hidden"
    value="#request_id#"></td>
    <td>#request_time#</td>
    <td>#firstname#&nbsp;#lastname#</td>
    <td>#LIN#</td>
    <td>#email#</td>
    <td>#title#</td>
    <td>#author#</td>
    <td>#callnum#</td>
    <td><input name="status_id" type="hidden"
    value="<cfoutput>#newstatus#</cfoutput>">
    <button>Mark Completed</button></td>
    </form>
    </tr>
    </cfoutput>

    TimMcGeary Guest

  2. #2

    Default Re: cfquery output duplicatig a cfset variable

    I think it is because of the nested cfoutput tags. You don't need the extra
    cfoutput around the hidden form field since the entire form is contained within
    an cfoutput query="...." statement



    <!--- removed extra cfoutput around hidden value --->
    <cfif to_lmc.recordcount gt 0>
    <cfoutput query="to_lmc">
    <tr><form action="item_received.cfm" method="post">
    ......
    <td><input name="status_id" type="hidden" value="#newstatus#">
    <button>Mark Completed</button></td>
    </form>
    </tr>
    </cfoutput>

    mxstu Guest

  3. #3

    Default Re: cfquery output duplicatig a cfset variable

    this show worked, but I don't understand why a <cfoutput> tag isn't needed
    since this variable is not part of the query output, but rather from a <cfset>.
    Does CF just default to a general <cfoutput> if a #variable# is not found in
    the query output?

    TimMcGeary Guest

  4. #4

    Default Re: cfquery output duplicatig a cfset variable

    Originally posted by: TimMcGeary
    Does CF just default to a general <cfoutput> if a #variable# is not found in
    the query output?

    Sort of. Using cfoutput query="..." doesn't mean only output values in the
    specified query. It is more like saying *include* ...or make accessible... the
    query values in this cfoutput operation. You are still using cfoutput which
    always evaluates all variables surrounded by pound signs.




    mxstu Guest

Similar Threads

  1. Output from different datasource in cfquery statement
    By Ryunosuke in forum Coldfusion Server Administration
    Replies: 3
    Last Post: February 5th, 10:24 PM
  2. Using form variable in a CFQuery
    By colesc8 in forum Coldfusion - Getting Started
    Replies: 2
    Last Post: September 13th, 05:13 PM
  3. output of a <cfquery>
    By cfcypher in forum Macromedia ColdFusion
    Replies: 3
    Last Post: June 9th, 06:23 PM
  4. Output from Cfquery
    By mike in forum Coldfusion Database Access
    Replies: 0
    Last Post: March 29th, 04:52 PM
  5. output variable to txt file
    By Matt McKay in forum Macromedia Flash
    Replies: 3
    Last Post: October 25th, 04:43 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •