4 Replies Latest reply on Nov 22, 2006 6:51 PM by Dan Bracuk

    Cold Fusion Question with: CF SWITCH

    Level 7
      I am using CFSWITCH for a long form. Its all working great, but I want to
      add some validation so I set up certain statements to make sure a form field
      from the previous step hasn't been overlooked. If it has then the error
      message shows rather than the next steps and asks you to return to the
      previous step. All works great.

      However, when you go back to the previous step I would like the header for
      the field that needs to be corrected to show in red (the error message
      style).

      I have tried setting a variable to true with the error message but when you
      hit the back button you loose the variable setting. I tried a session, but
      again, you loose it. Does anyone have any ideas that I can try so that I can
      get the headers to be in red for the user?

      Kim


        • 1. Re: Cold Fusion Question with: CF SWITCH
          Dan Bracuk Level 5
          Instead of sending them back to the previous step, send them forward to the previous step with some sort of http request. Then you get to set more variables and display your message.

          You should also investigate any ways that might be available for increasing the amount of validation done on the client when the form is submitted.
          • 2. Re: Cold Fusion Question with: CF SWITCH
            Level 7
            Dan,

            That would be something new to me. Can you point me to either a tutorial or
            something that would help explain this to me so I can research it.

            Thanks,
            Kim

            "Dan Bracuk" <webforumsuser@macromedia.com> wrote in message
            news:ek289v$fvq$1@forums.macromedia.com...
            > Instead of sending them back to the previous step, send them forward to
            > the
            > previous step with some sort of http request. Then you get to set more
            > variables and display your message.
            >
            > You should also investigate any ways that might be available for
            > increasing
            > the amount of validation done on the client when the form is submitted.
            >


            • 3. Re: Cold Fusion Question with: CF SWITCH
              dempster Level 1
              One way to do this is to have the form page submit to itself. If everything validates and all required fields are completed, the program can update a database (or whatever) and then either go on to another page (via CFLOCATION) or just display a message saying the form was submitted.

              Otherwise, the program can redisplay the form with an error message at the beginning. The values that were already submitted can be inserted in the various fields, and missing values could be checked so that they are highlighted with red text or a different color background.

              This is better from a usability perspective since the user receives the error message and can complete the form on the same page, instead of having to navigate back or to another page.
              • 4. Re: Cold Fusion Question with: CF SWITCH
                Dan Bracuk Level 5
                quote:

                Originally posted by: Newsgroup User
                Dan,

                That would be something new to me. Can you point me to either a tutorial or
                something that would help explain this to me so I can research it.


                An anchor tag will work. So will a form with a bunch of hidden fields and a submit button.

                If you want the user to be taken ahead back to the form page without having to do anything, the cflocation tag is available. So is meta refresh, javascript window.location, and so on and so forth.