5 Replies Latest reply on Apr 17, 2006 1:35 PM by dollarwebs

    Form Data not Updating

    dollarwebs
      This is a weird one folks! I have a site that people login to access a very large profile application. They basically have to fill out 5 large forms before being able to utilize the services of this website. These 5 forms have a corresponding database table (sql server). The problem I'm having is that occasionally, when someone fills out the form (which can take up to an hour, possibly a little more) and submits it, the form just goes blank and the data does not get updated in the database (using a standard sql update query)! As you can imagine, this is very frustrating for someone who just spent an hour filling out a form and not having it saved!

      Here is some additional detail...

      It has happened with all the forms (although I think it happens the most with the two bigger ones that have several textarea boxes).

      there are no errors of any kind

      Not a session thing because the timeout is set to like 5 hours and I've thoroughly tested to make sure the timeout goes to the login page

      happens with both cf 6.1 and cf7 and a sql server 2000 database

      cannot tell if this is a browser problem (for instance, does IE have problems submitting massive forms?), a CF thing or a sql / database thing. If anyone has any thoughts, I certainly welcome them!


        • 1. Form Data not Updating
          SafariTECH Level 1
          Have you actually verified that the data is not in the database? Dynamic forms when using a browser set to automatic cache settings (default) will sometimes not reflect changes because it reloaded the cached page.

          Is there any conditional statement(s) that precede the SQL statement that updates the database, that could cause it to ignore the submission? Sometimes conditional statements may return false when checking for form variables due to a glitch that affects some server/CF combinations. If you post the actionable code used when the form is submitted, we may be able to see a suspect.

          Aside from sessions or conditions (without seeing errors), there shouldn't be any issues in submitting any form from any browser.
          • 2. Re: Form Data not Updating
            dollarwebs Level 1
            Hi Glen,

            Thanks for your response. Here are the answers to your questions...

            1. Yes, the data is not being saved. The user moves on to the next form thinking it has, but when we go back to approve the user, we see that one of the forms is blank and that's usually when they tell us they filled it out and hit submit and that they didn't get any errors.

            2. Yes, there's a conditional statement... originally, it checked for a hidden form variable but just this morning I switched it to a url variable thinking that maybe there was a problem with the browser or something since these forms were so big. It does seem to me that the "process" form variable was being "ignored"... that was how I would describe what we're hearing from the users.

            <!--- Check for the "process" variable that is sent only when the form is submitted --->
            <CFIF isDefined("url.process")>

            <!--- Insert the info into the database --->
            <CFINCLUDE TEMPLATE="../queries/qry_updateeducation.cfm">

            <!--- Display your thank you message --->
            <B>Success!</B><BR>
            You've updated the profile data successfully!

            <!--- Display the form when the user first hits the page --->
            <CFELSE>

            <!--- Get information from the database --->
            <CFINCLUDE TEMPLATE="../queries/qry_geteducation.cfm">

            [ HTML form that displays the user data ]

            </CFIF>

            • 3. Re: Form Data not Updating
              SafariTECH Level 1
              If your form is submitting using the POST method, it will not detect a URL variable, so that would cause it to to be ignored anyway.

              If the form is being submitted via GET, then you could be losing the data for 2 reasons:

              a) the GET statement can only use a certain number of characters and
              b) the GET statement will not submit "form" variables, just URL variables

              If "process" is a hidden form field and you are submitting the form using the POST method, then you should be referencing everything using the FORM scope:

              <CFIF isDefined(" form.process")>

              HOWEVER ... there is a rare small glitch that shows up in some server/browser combinations where even if the form is submitted via POST, the system reads it as a GET submission, causing your validation/detection of the FORM scope to fail and therefore not process the subsequent commands.

              If you think this may be the problem, you can alter the conditional statement to a generic scope. This is not exactly a recommended practise, but if you see this occurring, it does fix the glitch.

              <CFIF isDefined(" process")>

              ( if you see the success message, however, this glitch is not likely the problem)


              If you are seeing the "success" message as part of the condition, could there be other conditions in the qry_updateeducation.cfm page that are getting ignored? If the data is not getting posted and the success message is appearing, then it means that something in-between the condition and the output is failing.

              Would you be willing to post the code from that file as well?
              • 4. Re: Form Data not Updating
                dollarwebs Level 1
                I think the form scope condition glitch may be happening here (I originally had it scoped to form). I've removed the scope to see if that fixes it. I've tried attaching the code, but everytime I do, it goes to a "page does not exist" error (I've written this response like 4 times!).

                Anyway, I'll try and post the code just in case there's anything else you can think of in a separate reply.

                Thanks so much!
                • 5. Re: Form Data not Updating
                  dollarwebs Level 1
                  I had to strip out the actual form fields because the site is not allowing me to attach code...

                  <!--- Check for the "process" variable that is sent only when the form is submitted --->
                  <CFIF isDefined("process")>

                  <!--- Stamp the transaction with the date/time and administrator --->
                  <CFINCLUDE TEMPLATE="inc_transactionstamp.cfm">

                  <!--- Insert the info into the database --->
                  <CFINCLUDE TEMPLATE="../queries/qry_updateeducation.cfm">

                  <!--- Display thank you message here. --->
                  <B>Success!</B><BR>
                  You've updated the profile data successfully!

                  <br> <br>

                  <cfif request.user.logintype is "Admin"><CFOUTPUT><A HREF="#PageFile#">Admin Home</A></CFOUTPUT></cfif>

                  <!--- Display the form when the user first hits the page --->
                  <CFELSE>

                  <!--- Get information from the database --->
                  <CFINCLUDE TEMPLATE="../queries/qry_geteducation.cfm">

                  <h2 style="border-bottom: 1px solid #3365AE;">Education / Employment   :   <CFOUTPUT><span style="font-size: 12px; color: rgb(32,114,61);">#getuserinfo.FirstName# #getuserinfo.LastName#</span></CFOUTPUT></h2>

                  <br> <br>

                  <!--- Display the form --->
                  <CFOUTPUT QUERY="geteducation">
                  <table border="0" cellspacing="0" cellpadding="3">
                  <FORM NAME="myform" ACTION="#PageFile#?Page=#Page#&Action=#Action#&Section=#Section#&UserId=#UserId#&process= go" METHOD="Post">
                  <tr>
                  <td colspan="4" nowrap class="formtext">What are your goals in life?</td>
                  </tr>

                  <tr>
                  <td colspan="4" nowrap><textarea name="Goals" cols="75" rows="5" class="formfield">#Goals#</textarea></td>
                  </tr>

                  <TR><TD COLSPAN="2"><IMG SRC="images/1pixel.gif" WIDTH="1" HEIGHT="2" BORDER="0"></TD></TR>

                  <TR>
                  <TD colspan="4" align="center"><INPUT TYPE="submit" VALUE="Update Information"></TD>
                  </TR>
                  <INPUT TYPE="hidden" NAME="process" VALUE="go">
                  </FORM>
                  </table>
                  </CFOUTPUT>

                  </CFIF>