5 Replies Latest reply on Sep 28, 2013 9:55 AM by iccsi

    refresh cfquery

    iccsi Level 1

      I have followign code to have my dropdown list, it seems that it does not refresh the list until re start the application.

      I have a create new button beside the list to let user create new records if it does not exsit.

      The create new record works, but the list does not refresh until next time to restart application.

      I would like to know is it possible to refresh cfquery on the select control when user add new record.

       

      Your help and information is great appreciated,

       

      Regards,

       

      Iccsi,

       

      <select name="Mylst" id="Mylst" >

       

         <cfoutput query="MySP">

               <option value="#MySP.MyID#"

                <cfif (isDefined("form.MyID") AND form.MyID EQ MySP.MyID) 

      >selected="selected"</cfif>>#MySP.MyName#</option>

             

             </cfoutput>

            

        </select>

        • 1. Re: refresh cfquery
          AnimeXCom

          It sounds like your have caching turned on in your query.  Can you please post your query code for the query "MySP"? You can either re-trigger the query to refresh it after you modify/create a record in that table or remove the caching setting from the query.

          • 2. Re: refresh cfquery
            iccsi Level 1

            <cfstoredproc procedure="Mystoredprocedure" datasource="mydb">

            <cfprocresult name="MySP" resultset="1">

            </cfstoredproc>

             

            I use MS SQL stored procedure and cfstoredproc for my select list data source.

            does caching setting at server side or client side?

            I think that I need refresh drop down list query,

             

            Thanks again for helping,

             

            Regards,

             

            Iccsi,

            • 3. Re: refresh cfquery
              AnimeXCom Level 1

              If there is no query caching turned on then maybe the issue is your page flow.  Unless you have caching turn on the database server somehow via the stored procedure?

              • 4. Re: refresh cfquery
                iccsi Level 1

                Thanks for the information and help,

                 

                I do not turn on caching from stored procedure.

                 

                Thanks again,

                 

                 

                Regards,

                 

                Iccsi,

                • 5. Re: refresh cfquery
                  iccsi Level 1

                  jQuery("#MySelect").change(function() {

                   

                                      jQuery.ajax({

                                                url: "Myserver.cfm?MyID=" + jQuery("#MySelect").val()

                                                , type: "get"

                                                , success: function(result) {

                                                          jQuery("#Myform").html(result);

                                                }

                                      });

                              });

                   

                  I think I know what is the problem.

                  This drop down box is a child of the form and it created at run time by jQuery on change even of one drop down.

                  I think that I need re create the child form since it created by jQuery using html result.

                   

                  Thanks again for your help and information,

                   

                  Regards,

                   

                  Iccsi,