Closed Thread
Results 1 to 8 of 8

Thread: Error handling

  1. #1
    Join Date
    Mar 2009
    Posts
    11

    Default Error handling

    Hi there - I'm rapidly running out of hair to pull, so please, pretty please, pretty please with chocolate on top, help.

    First, I can't implement fmbadhandler.php - when I tried it I received the error "URL open failed: fopen(http://www.microsoft.com) [function.fopen]: failed to open stream: no suitable wrapper could be found

    So, I've tried the sampleerrortemplate.htm (located in a templatedir) after adding the necessary statement to the form:
    Code:
    <input type="hidden" name="good_url" value="http://www.castlefarmbandb.co.uk/emailtemplates/emailthanks.shtml" />
    <input type="hidden" name="bad_url" value="http://www.castlefarmbandb.co.uk/emailtemplates/sampleerrortemplate.html" />
    and defining the templatedir in formmail.php
    Code:
    $TEMPLATEDIR = "http://www.castlefarmbandb.co.uk/emailtemplates";
    The sampleerrortemplate.htm is displayed after a user error - but the error fields
    Code:
    <fmusererror>
        <p>This is a list of items in error:</p>
        <ul>
            <fmerroritemlist />
        </ul>
    </fmusererror>
    are not being populated when the page is displayed.

    What am I missing here?

    Thanks - Phil.

  2. #2
    Join Date
    Feb 2009
    Posts
    34

    Default Re: Error handling

    I thinking somethings missing here. I say this because I dont see you stating anything in your form pointing to fmbadhandler as shown below.
    Code:
    <input type="hidden" name="bad_url" value="http://www.yourwebsite.com/fmbadhandler.php"
    Try using bad_template and good_template instead of the url as highlighted below.

    Code:
    <input type="hidden" name="good_url" value="http://www.castlefarmbandb.co.uk/emailtemplates/emailthanks.shtml" />
    <input type="hidden" name="bad_url" value="http://www.castlefarmbandb.co.uk/emailtemplates/sampleerrortemplate.html" />
    Also The
    $TEMPLATEDIR = must be set in both formmail and fmbadhandler.

    I'm not an expert with this but I know mine does work and I just pointing out what worked for me. Hope this helps you.

  3. #3
    Join Date
    Mar 2009
    Posts
    11

    Default Re: Error handling

    The correct error page is being displayed, but the <fmerroritemlist /> etc is not being populated. I can see all the errors at the end of the url in the browser address bar though - like:
    Code:
    <snip>...emailfail.html?this_form=http%3A%2F%2Fwww.castlefarmbandb.co.uk%2Fcontact.shtml&bad_template=emailfail.html&error=The+form+required+some+values+that+you+did+not+seem+to+provide....<snip>.
    So, the correct error page is being displayed and the errors are being passed to it - it's not substituting the error(s) in the tags in the html though.

    I'm baffled, as it says/implies in the doc' that that's all I have to do.

    Can you point me to a site where you've got this working so I can check my code against it please.

  4. #4
    Join Date
    Feb 2009
    Posts
    34

    Default Re: Error handling


  5. #5
    Join Date
    Mar 2009
    Posts
    11

    Default Re: Error handling

    I've read that page - and nearly every other page of the documentation until I'm blue in the face. As far as I can see I've done everything correctly.

  6. #6
    Join Date
    Mar 2009
    Posts
    11

    Default Re: Error handling

    The page you pointed to says:
    HTML Template
    You create an HTML document that will be used as a template for your error page. You can format the error page to look exactly like the other pages on your website. This is a template because you can specify where errors are to be displayed by using special tags that FormMail will replace with error messages. FormMail displays your template to the user with the error messages displayed where you want them.
    Then it goes on to talk about fmbadhandler.php. To me this implies that there is some basic error handling without fmbadhandler being used. As I say - the page I want displayed to the user in the event of them leaving out information IS being displayed, but the "special tags that FormMail will replace with error messages" are not being populated with the errors.

  7. #7
    Join Date
    May 2008
    Posts
    1,274

    Default Re: Error handling

    As spalmere said, you don't appear to be referencing fmbadhandler.php in your form code, at least from what you've shown.

    Also, you should be using bad_template for your error page, and bad_url for fmbadhandler.php.

    HTML Code:
    <input type="hidden" name="bad_template" value="sampleerrortemplate.html">
    <input type="hidden" name="bad_url" value="http://www.castlefarmbandb.co.uk/fmbadhandler.php">
    The value you have in $TEMPLATEDIR is what would normally go in $TEMPLATEURL. If you use that, then don't put anything in $TEMPLATEDIR, although normally you would use $TEMPLATEDIR instead of $TEMPLATEURL unless your error template is doing other php processing, which yours isn't. To get the correct value for $TEMPLATEDIR you'll need to run test alert and get the server path to your document root, and then add your template directory onto that.

    As spalmere said, you need to specify either $TEMPLATEDIR or $TEMPLATEURL (whichever you're using) in both formmail.php and fmbadhandler.php

    Aside from all of that, I just entered the url for fmbadhandler.php on your site, and there's a syntax error, so you must have made a mistake when editing.

  8. #8
    Join Date
    Mar 2009
    Posts
    11

    Default Re: Error handling

    For anyone else with the same problem:

    Contrary to what it says in the doc (and supporting what it say in the doc, because it is very ambiguous) - it isn't possible to do what I was trying with a plain HTML file.

    You'll have to use PHP to get the data that's passed to your error page for you to display to the user.

    Considering that I hadn't used PHP before, it didn't take me that long to figure it out and get an error page to display how I wanted.

    Good luck.

Closed Thread

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. Advanced Error Handling
    By russellr in forum HOWTO Guides and Tips
    Replies: 12
    Last Post: 26-Oct-2005, 11:38 PM
  2. Error Handling Heirarchy
    By duncanad in forum FormMail Subscription Support
    Replies: 1
    Last Post: 12-Oct-2005, 01:07 AM
  3. error handling help
    By phatisimo in forum FormMail Subscription Support
    Replies: 2
    Last Post: 29-Sep-2005, 11:45 PM
  4. Advanced Error Handling - failed to open stream: Connection timed out
    By Antonimo in forum FormMail Subscription Support
    Replies: 5
    Last Post: 31-Aug-2005, 07:52 AM
  5. HTML Template for error handling
    By CWD in forum FormMail Subscription Support
    Replies: 14
    Last Post: 27-Jul-2005, 06:19 AM

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