Results 1 to 7 of 7

Thread: FmBadHandler

  1. #1
    Join Date
    Mar 2011
    Posts
    43

    Default FmBadHandler

    Hi!

    I am using FormMail.php version 8.29 and FmBadHandler,php version 1.22.

    When a form error is encountered, an error message is displayed:

    Form Error

    Your form …

    Some of the values …

    ● Title missing

    Using the browser’s (IE version 8) Back Button, returns the form with the information loaded ready to be filled with the title.

    The error message, however, does not specify how the visitor should return to the form.

    How can I tell the visitor to use the browser’s Back Button or, better yet, provide a link back to the form?

    I read the documentation but it is not clear to me how to do it.

    Thank you.

    Dr. T.

  2. #2
    Join Date
    Jul 2011
    Posts
    45

    Default Re: FmBadHandler

    If you're using an errortemplate form, fmbadhandler.php (which you should already have set up as the bad_url parameter of your form) will insert the code in it to provide a link back to your form.

    Check out http://www.tectite.com/fmhowto/adverror.php and http://www.tectite.com/vbforums/show...for-you-to-use

  3. #3
    Join Date
    Mar 2011
    Posts
    43

    Default Re: FmBadHandler

    Dear Ben,

    Thank your for your reply.

    Instead of using a template, what about adding the following link to FmBadHandler.php as shown below?

    <p><big>Please click <a href=”$return_link””>HERE</a> to return to form.</big></p>



    {
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Form Submission Error</title>
    </head>
    <body>
    <h2>Form Error</h2>
    <p>Your form submission failed due to the following reason:</p>
    <p><?php echo nl2br(htmlspecialchars($sErrorMesg)); ?></p>
    <ul>
    <?php
    foreach ($aItems as $s_item)
    echo "<li>".htmlspecialchars($s_item)."</li>";
    ?>
    </ul>

    <p><big>Click <a href=”$return_link””>HERE</a> to return to form.</big></p>

    <?php
    if (!$bIsUserError && $bAlerted)
    echo "<p>Our staff have been alerted to the problem. ".
    "We apologize for any inconvenience.</p>";
    if ($bIsUserError)
    echo GetFormLink($sURL);
    ?>
    </body>
    </html>
    <?php
    }


    Dr. T.

  4. #4
    Join Date
    Jul 2011
    Posts
    45

    Default Re: FmBadHandler

    Looks like a lot of work to me.

    All the work has already been done for you - all you need do is send your user to fmbadhandler and it does the rest for you.

    Why make extra work?

  5. #5
    Join Date
    Mar 2011
    Posts
    43

    Default Re: FmBadHandler

    Dear Ben,

    Again, thank you for your reply.

    Perhaps I wasn't clear. I am already using FmBadHandler. php. All I propose to do is to add one statement to FmBadhandler.php:
    <p><big>Please click <a href=”$return_link””>HERE</a> to return to form.</big></p>

    This will tell the user how to get back to the form, which version 1.22 does not specify how to.

    I want to know if "$return_link" is already defined by FmBadHandler.php.

    Dr. T.

  6. #6
    Join Date
    Jul 2011
    Posts
    45

    Default Re: FmBadHandler

    If you read the documentation of fmbadhandler.php and the sample template you'll see the following in the html for the sample template:-


    <!-- If you use fmbadhandler.php from www.tectite.com, it will insert the link to return to the form at the end of the page body (here). (Provided it's setup correctly, of course. In particular, you need to set $TARGET_URLS appropriately.) -->

    That will not only report the error encountered but also provide a link back to the form and repopulate the input for you.

    If you really want to reinvent the wheel spending ages in your laboratory when there's a wheel already sitting waiting for you on the bench, by all means go ahead.

    If you want to know if any values are defined in fmbadhandler, you could always have a look. I have no idea - I use fmbadhandler with error templates, have no problem getting back to the form nor in informing the user or reporting back to myself as webmaster the error that occurred.


    Edit:-

    I have looked at the coding, and return_link is used by fmbadhandler so you can set it if required. Check the documentation. In http://www.tectite.com/fmhowto/adverror.php it is stated:-

    And finally.....fmbadhandler.php puts the return link to your form just before the body end tag "</body>". If you want it in a different place, use the following tag:

    [return_link /]

    For FormMail version 8.24 and below and FMBadHandler version 1.22 and below, the tag format was: <return_link />
    If you want to include just the URL of the return link (i.e. this_form), you can use $return_link, like this:
    <a href="$return_link">Return to form</a>
    Last edited by Ben; 12-Oct-2011 at 07:44 PM.

  7. #7
    Join Date
    Mar 2011
    Posts
    43

    Default Re: FmBadHandler

    Dear Ben,

    Thank you for all your replies!

    I finally figured it out. I had changed "$TARGET_URLS" in FormMail.php but not in FmBadHandler.php.

    I changed it and, to make it clearer to the user, I changed the link in FmBadHandler.php to:
    $s_link = "<p>To return to the form to fix the errors, please <a href=\"".htmlentities($s_url)."\">CLICK HERE</a>.</p>";

    I tested it and it works!

    Dr. T.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •