Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3852810
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:22:22+00:00 2026-05-19T17:22:22+00:00

I have a form "test.cfm" It passes values to an action page "testAction.cfm"! test.cfm

  • 0

I have a form "test.cfm" It passes values to an action page "testAction.cfm"!

test.cfm does the following:-

  1. A drop down box “fruitsList”.

  2. A query “qryFruits” that pulls data and then displays the query-result set

  3. “Add” button for every query-result set

How it should work:-

  1. The dropdown “fruitsList” is to be selected.

  2. Once the “Add” button in the result list is selected the “query-result set -CurrentRow” value is to be passed.

Add button is passing the “query-resultset -CurrentRow” value but NOT the "Drop down" Value.

How to pass the “dropdown- selected-value”?

    <!--- test.cfm --->
    <script type="text/javascript" >
          function assign_fruits()
         //  
         {
           var a = document.fruitsForm.fruitsList.selectedIndex;
           document.getElementById('salesForce').value = document.fruitsForm.fruitsList.options[a].value; 
           }
        </script>
    
    <form name="fruitsForm" >
    <table>
      <tr>
       <td>
        <select name="fruitsList" onChange="assign_fruits()">
         <option disabled="true">select One
         <option value="m1">apple
         <option value="m2" selected>orange
         <option value="m3">banana
         <option value="m4">grape
         <option value="m5">mango
        </select> 
       </td>
<!--- Trying to assign the DD-value to an input field --->
 <input  name="salesForce" value=""> 
      </tr> 
     <cfquery name="qryFruits" datasoure="#dsn#">
      Select values from Fruits_Table
     </cfquery>
     <cfloop startrow="1" endrow="#qryFruits.recordcount#" query="qryFruits">
      <cfoutput>
      <tr> 
       <td><a href="testAction.cfm">Add</a></td>     
      </tr>   
      </cfoutput>
     </cfloop>
    </table>
    
    </form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T17:22:23+00:00Added an answer on May 19, 2026 at 5:22 pm

    You are going about this a bit unconventionally but I believe the following does what you’re looking for:

     <cfdump var="#form#">
    
    <!--- test.cfm --->
    <cfset qryFruits = queryNew("fruitID,fruitName")>
    <cfset queryAddRow(qryFruits, 2)>
    <cfset querySetCell(qryFruits, "fruitID", 1, 1)>
    <cfset querySetCell(qryFruits, "fruitName", "Kiwi", 1)>
    <cfset querySetCell(qryFruits, "fruitID", 2, 2)>
    <cfset querySetCell(qryFruits, "fruitName", "Lime", 2)>
    
    <script type="text/javascript" >
        function assign_fruits() {
            var a = document.fruitsForm.fruitsList.selectedIndex;
            document.getElementById('salesForce').value = document.fruitsForm.fruitsList.options[a].value; 
        }
        function submit(id) {
            document.getElementById('fruitClicked').value = id;
            document.forms["fruitsForm"].submit();
        }
    </script>
    
    <form name="fruitsForm" id="fruitsForm" action="index.cfm" method="post">
        <p>
            <select name="fruitsList" onChange="assign_fruits();">
                <option value="">select One</option>
                <option value="m1">apple</option>
                <option value="m2" selected>orange</option>
                <option value="m3">banana</option>
                <option value="m4">grape</option>
                <option value="m5">mango</option>
            </select>
        </p>
    
        <!--- Trying to assign the DD-value to an input field --->
        <p>Fruit Slected from List Above: <input name="salesForce" id="salesForce" value=""></p>
        <p>Fruit Clicked Below: <input name="fruitClicked" id="fruitClicked" value=""></p>
        <cfloop startrow="1" endrow="#qryFruits.recordcount#" query="qryFruits">
        <cfoutput>
            <div></div><a href="##" onclick="submit(#qryFruits.fruitID#);">#qryFruits.fruitName#</a></div>
        </cfoutput>
        </cfloop>
    </form>
    

    Note that you are missing “id” attributes in some of your elements which was causing your JavaScript to fail.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following problem. I have the following form <form name="asianCalculator" action="" id="asianCalculator"
I have this simple form: <form method="post" action"."> <input type="text" name="title"> <input type="submit" name"send">
I have a simple html form: <form action="/api/userattributes" method=get> <select name=action> <option>read_by_user</option> <option>set</option> <option>delete</option>
I have a form where users can add input fields with jQuery. <input type="text"
i have form action file in another directory but some file send to this
I have a web page on which I have a form. This form contains
I get an internal server error with the following code... any suggestions: <form name="user"
In my page I have a form tag which submits to server, gets data
I have a form with an id of "wizard" - I only have select
I have a page which submits a form on page load and redirects the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.