Problem with dynamically assigning FORM value

Discussion in 'Programming' started by dul3728, Oct 25, 2006.

  1. #1
    Hello everyone,

    I am trying to pass some coldfusion variables through a form to a different cfm page.

    <cfset tName = "#form.taskName#">
    <cfset sBy = "#form.submittedBy#">

    <form name="emailback" action="emailFB.cfm" method="post">
    <input type="hidden" name="tNameC" value= "#tName#">
    <input type="hidden" name="sByC" value="#sBy#">
    <input name="submitQ" type="submit" value="Submit Job"></form>

    On the emailFB.cfm page:

    <cfoutput><strong>Task:</strong> #form.tNameC#</cfoutput> <br/>
    <cfoutput><strong>Submitted by:</strong> #form.sByC#</cfoutput> <br/>

    Output on the emailFB.cfm page is:

    Task: #tName#
    Submitted by: #sBy#

    Can somebody please tell me how I can pass the value in form.taskName and form.submittedBy to emailFB.cfm page.

    Thanks a lot in advance,

    dulc.
     
    dul3728, Oct 25, 2006 IP
  2. dul3728

    dul3728 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Thanks everyone.... got the solution from a different forum.

    The first page should look like THIS to work...

    <cfset tName = form.taskName> <!--- No quotes and no octothorpes. --->
    <cfset sBy = form.submittedBy>

    <CFOUTPUT> <!--- Need this for variables to "print" to the form fields. --->
    <form name="emailback" action="emailFB.cfm" method="post">
    <input type="hidden" name="tNameC" value= "#tName#">
    <input type="hidden" name="sByC" value="#sBy#">
    <input name="submitQ" type="submit" value="Submit Job"></form>
    </CFOUTPUT>


    dul.
     
    dul3728, Oct 26, 2006 IP
  3. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #3
    or instead of putting CFoutput around the entire form, use cfform and cfinput instead of form and input
     
    datropics, Oct 26, 2006 IP