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 9124079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:29:31+00:00 2026-06-17T06:29:31+00:00

I have a form in a coldfusion page. After hitting save button which is

  • 0

I have a form in a coldfusion page. After hitting save button which is inserting into a table, I need to reload the page with the new values of the table in a select box. Though the page is refreshing after submit, I am not able to see the new inserted value in the drop down. Only after manually refreshing the page I can see it. I have the below code

  <script>
        function confirm_insert()
        {
            var ok = confirm("Are you sure you want to save the changes?");
            if (ok)
            {
                document.myform.submit();   
                return true;
            }
            else
            {
                return false;
            } 
        }
    </script>  

<form name="myform" action="bsc_lookup_number_add.cfm" method="post" >
           <td><input type="text" <cfif      isDefined('page.select_Main_Group')>value="#page.select_Main_Group#"</cfif>></td>
           <td><input type="text" <cfif isDefined('page.select_Sub_Group')>value="#page.select_Sub_Group#"</cfif>></td>
          <td><input name="newfirstchars" type="text" value="" maxlength="3"></td>

    <input type="submit" class="button" name="saverecord" id="saverecord"  style="width:100px" value="Save Record" onClick="return confirm_insert();">

            <cfquery name="first3" datasource="mbtran">
            select * from (
       select cast((substr(A.LABORLEVELNAME2, 1, 3)) as varchar2(5 byte)) first_3_pos
        from tkcsowner.VP_LABORACCOUNT a  
         <cfif isDefined('page.select_Sub_Group')>         
        where substr(A.LABORLEVELNAME1, 1, 5) || substr(A.LABORLEVELNAME2, 4, 2) = ('#page.select_Main_Group#' || '#page.select_Sub_Group#')
        </cfif>
        union
        select  A.FIRST_3_CHARS_IN_POSITION first_3_pos
        from kronos_if.FIRST_3_CHARS_IN_POSITION a    
         <cfif isDefined('page.select_Sub_Group')>     
        where A.DEPTID || A.UNION_CD = ('#page.select_Main_Group#' || '#page.select_Sub_Group#') 
        </cfif>
        )                          
        order by first_3_pos        
        </cfquery>

                <cfif isDefined('page.select_Sub_Group')>
                <td align="center">
                <select name="first3" id="first3" required="yes"        onchange="this.form.submit()">
             <option>Select</option>
             <cfloop query="first3">
                 <option value="#first_3_pos#" <cfif             isDefined('form.first3')><cfif form.first3 eq "#first_3_pos#">selected</cfif>       </cfif>>#first_3_pos#</option>
             </cfloop>
            </select></td>      

       </cfif>


         <cfif isdefined ("form.saverecord") and isdefined("form.newfirstchars")>

 <cfquery name="saverec" datasource="mbtran">

               insert INTO kronos_if.FIRST_3_CHARS_IN_POSITION
              (deptid,union_cd, first_3_chars_in_position,effdt)
                      values('#page.select_Main_Group#','#page.select_Sub_Group#','#FORM.newfirstchars#',sysdate)

</cfquery>               


        </cfif>

</form>

Please advice. thanks

Screenshot

  • 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-06-17T06:29:32+00:00Added an answer on June 17, 2026 at 6:29 am

    The query to INSERT the record is after the query you use to populate the drop down. You need to move this code

    <cfif isdefined ("form.saverecord") and isdefined("form.newfirstchars")>
    
    <cfquery name="saverec" datasource="mbtran">
        insert INTO kronos_if.FIRST_3_CHARS_IN_POSITION
        (deptid,union_cd, first_3_chars_in_position,effdt)
        values ('#page.select_Main_Group#','#page.select_Sub_Group#','#FORM.newfirstchars#',sysdate)
    
    </cfquery>               
    
    
    </cfif>
    

    above the select queries.

    You also want to look into using cfqueryparam – http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f6f.html

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

Sidebar

Related Questions

I'm new to coldfusion. I have page called test1.cfm <form action = test2.cfm method
I have a legacy .cfm (ColdFusion) page which used to process form data (from
I have the below form in my ColdFusion page: <form name=adminsignin action=swipelogin.cfm method=POST> <input
I have form with 1 button. when you click on the button 3 others
I have form with few buttons and I want to know what button is
I have form in my page, I am using ajax.beginform(). Inside this form I
Within a form I have a button that launches a cfwindow, then presents a
I have a modal which pops out a form, allowing an admin to edit/update
Does Coldfusion have a Global structure where the expressions global[FORM] , global[URL] , global[APPLICATION]
I'm using $('form-selector').get(0).reset() to reset form values to their original page load state. After

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.