9 Replies Latest reply on Sep 12, 2008 4:50 AM by Günter Schenk

    Why is this not working??

      I want return a status after the email was send ( I need this for flash )

      //start Trigger_Custom trigger
      function Trigger_Custom(&$tNG) {
      $status = "send";
      return $status;
      }
      //end Trigger_Custom trigger

      // Register triggers
      $ins__3bit_->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
      $ins__3bit_->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
      $ins__3bit_->registerTrigger("AFTER", "Trigger_SendEmail", 98);
      $ins__3bit_->registerTrigger("END", "Trigger_Custom", 50);

      I hope dat someone can help me... This is urgent :-(

      greetings
        • 1. Re: Why is this not working??
          Günter Schenk Level 4
          Hi Maikel,

          where is this status message supposed to be displayed ?

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Why is this not working??
            Level 1
            It should be display when the email was send successfully..

            if ($status == "send")
            {
                 echo  "ok";
            }
            else
            {
                 echo "nok";
            }
            • 3. Re: Why is this not working??
              Günter Schenk Level 4
              The problem I see is:

              a) once the transction has been executed respectively the emails have been sent, the current page will redirect to another page (e.g. a Dynamic List), and any attempt to "echo" something will at least fail for the current page, and the value of your variable "$status" will be discarded.

              b) if the Send Email trigger has done its job, the email *have* been sent, and you´ll get redirected -- but if Send Email fails to execute for whatever reason, you´ll be getting an ADDT driven error message anyway.

              Well, maybe *I* just don´t get it ;-)

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: Why is this not working??
                Level 1
                This page get's a POST from flash and is expecting an answer back
                there will be no redirecting at all

                everything is working great except this part:

                if ($status == "send")
                {
                echo "ok";
                }
                else
                {
                echo "nok";
                }
                • 5. Re: Why is this not working??
                  Günter Schenk Level 4
                  -------
                  This page get's a POST from flash and is expecting an answer back
                  there will be no redirecting at all
                  -------

                  will that answer (aka the variable´s value) have to be echoed within the document´s body ?

                  Cheers,
                  Günter Schenk
                  Adobe Community Expert, Dreamweaver
                  • 6. Re: Why is this not working??
                    Level 1
                    Yes have to bo echoed within the body.
                    • 7. Re: Why is this not working??
                      Günter Schenk Level 4
                      ------
                      Yes have to bo echoed within the body
                      ------

                      but wouldn´t the page have to get reloaded for displaying the initially non-existing message ?

                      Cheers,
                      Günter Schenk
                      Adobe Community Expert, Dreamweaver
                      • 8. Re: Why is this not working??
                        Level 1
                        Hello Günther,

                        The page does not have to be reloaded I just want to echo an send if everything went fine or a not send if the mail was not send.

                        greetings, Maikel
                        • 9. Re: Why is this not working??
                          Günter Schenk Level 4
                          Hi Maikel,

                          once a page loads, the initially displayed body contents of a regular HTML page (I´m not talking about advanced technics at this point) is all you get. If you want to change a certain part (e.g. the visibility or the contents of a paragraph) of the document on-the-fly and without reloading the page, you´d have to resort to DOM manipulating technics such as "AJAX" which could do that.

                          ------
                          I just want to echo an send if everything went fine or a not send if the mail was not send
                          ------

                          I understand what you want, but I think that your Custom Trigger (respectively what it´s supposed to do) will not have any effect for several reasons:

                          a) it´s an END trigger which only gets triggered if the previous SendEmail trigger did execute without errors -- that said, if the SendEmail trigger did fail to work for whatever reason and the emails hence could not be sent, your Custom Trigger won´t get executed anyway and is practically useless.

                          b) your Custom Trigger is supposed to return some value in the document´s body -- but without implementing some AJAX routines you just can´t have that on the very same "non-reloaded" page.

                          If you really need to display some sort of "success" status message, I´d suggest to indeed redirect to another page after all and display this message there, because that´s the only reliable way, as this redirection would not occur in case the emails couldn´t be sent respectively the SendEmail trigger failed to execute.

                          Cheers,
                          Günter Schenk
                          Adobe Community Expert, Dreamweaver