Loading ...
Sorry, an error occurred while loading the content.

Ajax Submit & Errors with $form->ShowAllErrors=1;

Expand Messages
  • jake.strawn
    Okay, I just stumbled upon this great class at phpclasses, and I must say, it looks great, and the code is well written, and robust for a form system to expand
    Message 1 of 4 , Jul 25 10:45 PM
    • 0 Attachment
      Okay, I just stumbled upon this great class at phpclasses, and I must
      say, it looks great, and the code is well written, and robust for a
      form system to expand from for various projects, so kudos to the
      creator, and thanks..

      Now, I'm working on my first implementation, and I would be using the
      ajax functionality 99% of the time with this class simply because it's
      already built in, and I've been wanting to incorporate that into some
      current forms...

      I'm having a problem, when I set the value:

      $form->ShowAllErrors=1;

      I made this value 1 so that I could have all the errors pop up in the
      javascript alert window at once, which looks nice, and isn't as
      tedious as one error at a time popping up if there are many for a user....

      That part works great, but if all the fields are filled out, and the
      showallerrors is set to 1, it will not continue on, but ONLY take me
      back to the form in read only format, with no editiable values...

      I tested this by removing all but 2 form fields to do some testing,
      and after setting the $form->ShowAllErrors=1; back = to 0, it works
      like a charm, and the entire form processes properly...

      Is this a known error, or functionality???

      It doesn't seem to be dependant on my code, but I can post some
      tomorrow if needed for further investigation...

      Thanks again for a great looking script....
    • Manuel Lemos
      Hello, ... That is just what the example script does. In your real scripts, you would do something else. Take a look at the section of the script like below.
      Message 2 of 4 , Jul 25 11:16 PM
      • 0 Attachment
        Hello,

        on 07/26/2006 02:45 AM jake.strawn said the following:
        > I'm having a problem, when I set the value:
        >
        > $form->ShowAllErrors=1;
        >
        > I made this value 1 so that I could have all the errors pop up in the
        > javascript alert window at once, which looks nice, and isn't as
        > tedious as one error at a time popping up if there are many for a user....
        >
        > That part works great, but if all the fields are filled out, and the
        > showallerrors is set to 1, it will not continue on, but ONLY take me
        > back to the form in read only format, with no editiable values...

        That is just what the example script does. In your real scripts, you
        would do something else.

        Take a look at the section of the script like below. It makes the form
        read only and continues to make the form be displayed again.

        Just replace this code with something useful.

        if($doit)
        {

        /*
        * The form is ready to be processed, just output it again as read only to
        * display the submitted values. A real form processing script usually may
        * do something else like storing the form values in a database.
        */
        $form->ReadOnly=1;
        }



        --

        Regards,
        Manuel Lemos

        Metastorage - Data object relational mapping layer generator
        http://www.metastorage.net/

        PHP Classes - Free ready to use OOP components written in PHP
        http://www.phpclasses.org/
      • jake.strawn
        Thanks for the info, however, this doesn t solve the problem that I was noticing... I m using the ajax system, so as soon as the submit button is clicked,
        Message 3 of 4 , Jul 26 5:53 AM
        • 0 Attachment
          Thanks for the info, however, this doesn't solve the problem that I
          was noticing...

          I'm using the ajax system, so as soon as the submit button is clicked,
          there is the indicator, and then it moves to message.html.php, where
          it does the fancy little counter, and then to the confirmation page...

          I have used the ajax_test script as my basis, and worked from there...
          the problem I'm having is after completing the full form, when I hit
          submit, there is no indicator, and no feedback, and it just takes you
          back to the form....

          however, EVERY field is populated, taking care to make sure all the
          rules I set were followed, but it just returns me right back to the
          form with no feedback, where otherwise, before, it was finally
          redirecting me to a custom thank you page I set up

          The section you mentioned does not appear to be where you would
          actually process to a database or email, since this section further up
          the script is where I had found that notation, however, I have still
          just been working on the form, and getting it submitted rather than my
          backend processing at this point...

          for($progress = 1 ; $progress<=100; $progress++)
          {

          /*
          * Pretend to execute an operation that takes time to complete.
          * Here you would actually execute a a step of your
          * lengthy processing action.
          */
          usleep(50000);

          /*
          * Update the progress display.
          */
          $form->SetInputProperty("sender", "Feedback", sprintf("%0d",$progress));
          }
          I did reset this section, and now, it will send me at least back to a
          form I can edit the fields of the form, but the submit button is gone,
          just as it was with the read only on, so no difference really...

          Thanks for looking at this, and helping me out...

          let me know, and I can submit my full code for this, and you can see
          what you think...


          --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
          >
          > Hello,
          >
          > on 07/26/2006 02:45 AM jake.strawn said the following:
          > > I'm having a problem, when I set the value:
          > >
          > > $form->ShowAllErrors=1;
          > >
          > > I made this value 1 so that I could have all the errors pop up in the
          > > javascript alert window at once, which looks nice, and isn't as
          > > tedious as one error at a time popping up if there are many for a
          user....
          > >
          > > That part works great, but if all the fields are filled out, and the
          > > showallerrors is set to 1, it will not continue on, but ONLY take me
          > > back to the form in read only format, with no editiable values...
          >
          > That is just what the example script does. In your real scripts, you
          > would do something else.
          >
          > Take a look at the section of the script like below. It makes the form
          > read only and continues to make the form be displayed again.
          >
          > Just replace this code with something useful.
          >
          > if($doit)
          > {
          >
          > /*
          > * The form is ready to be processed, just output it again as read
          only to
          > * display the submitted values. A real form processing script
          usually may
          > * do something else like storing the form values in a database.
          > */
          > $form->ReadOnly=1;
          > }
          >
          >
          >
          > --
          >
          > Regards,
          > Manuel Lemos
          >
          > Metastorage - Data object relational mapping layer generator
          > http://www.metastorage.net/
          >
          > PHP Classes - Free ready to use OOP components written in PHP
          > http://www.phpclasses.org/
          >
        • Manuel Lemos
          Hello, ... This happens when the form is not being submitted via AJAX. If you changed the example script, either you introduced something that is causing a
          Message 4 of 4 , Jul 26 11:21 AM
          • 0 Attachment
            Hello,

            on 07/26/2006 09:53 AM jake.strawn said the following:
            > I'm using the ajax system, so as soon as the submit button is clicked,
            > there is the indicator, and then it moves to message.html.php, where
            > it does the fancy little counter, and then to the confirmation page...
            >
            > I have used the ajax_test script as my basis, and worked from there...
            > the problem I'm having is after completing the full form, when I hit
            > submit, there is no indicator, and no feedback, and it just takes you
            > back to the form....
            >
            > however, EVERY field is populated, taking care to make sure all the
            > rules I set were followed, but it just returns me right back to the
            > form with no feedback, where otherwise, before, it was finally
            > redirecting me to a custom thank you page I set up

            This happens when the form is not being submitted via AJAX.

            If you changed the example script, either you introduced something that
            is causing a Javascript error, or the the form_ajax_submit input is not
            being added to the form properly.

            It is hard to tell without seeing what changes have you made to the
            script or at least see the form page to see if it is giving you any error.

            If you use Firefox (strongly recommended for development purposes), I
            suggest that you install the Firebug extension as it helps seeing all
            kinds of Javascript and CSS errors.

            --

            Regards,
            Manuel Lemos

            Metastorage - Data object relational mapping layer generator
            http://www.metastorage.net/

            PHP Classes - Free ready to use OOP components written in PHP
            http://www.phpclasses.org/
          Your message has been successfully submitted and would be delivered to recipients shortly.