We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44312
    • 9 Posts
    I just realized I did not put this in the appropriate FormIt sub-forum. Could a mod please adjust this error. Thanks

    I had FormIt working perfectly sending me emails no problem. But the one thing I was having an issue with was the validation showing the errors. After reading another post on here I managed to fix it with the error placeholders added to the HTML code. But, as soon as I did that, I started having a much bigger issue.

    Everytime I try and submit the form now I get an error. Sotwell told someone to clear their core/cache/ folder manually. I tried to delete the folders in MODX manager, but a few of them just would not delete. Should I delete this folder in my OS filesystem? What else could I do to try and fix this issue?

    [2013-07-02 20:06:09] (ERROR @ /index.php) [FormIt] Could not find hook "`spam` ".
     [2013-07-02 20:06:09] (ERROR @ /index.php) [FormIt] Could not find hook "`email` ".


    This is my code

    [[!FormIt? 
    &hooks=`spam,email` 
    &emailTpl=`sentEmailTpl` 
    &emailSubject=`Message from CamWright.` 
    &emailTo=`[email protected]` 
    &validate=`contact_email:email:required`]]
    
    <form id="contactForm" class="cmxform" action="[[~[[*id]]]]" method="post">
    <strong>Please use the form below to send us an email:</strong>
    <div>
    	<label for="contact_name">Name </label><em>(required, at least 2 characters)</em>
    	<span class="error">[[!+fi.error.contact_name]]</span><br /> 
    	<input id="contact_name" class="required" type="text" name="contact_name" value="[[!+fi.contact_name]]" size="30" />
    </div>
    <div>
    	<label for="contact_email">E-Mail </label><em>(required)</em>
    	<span class="error">[[!+fi.error.contact_email]]</span><br /> 
    	<input id="contact_email" class="required email" type="text" name="contact_email" value="[[!+fi.contact_email]]" size="30" />
    </div>
    <div>
    	<label for="contact_phone">Phone </label><em>(optional)</em>
    	<br /> 
    	<input id="contact_phone_NA_format" class="phone" type="text" name="contact_phone_NA_format" value="[[!+fi.contact_phone_NA_format]]" size="14" maxlength="14" /> 
    	<label for="contact_ext">ext. </label> 
    	<input id="contact_ext_NA_format" class="ext" type="text" name="contact_ext_NA_format" value="[[!+fi.contact_ext_NA_format]]" size="5" maxlength="5" />
    </div>
    <div>
    	<label for="contact_message">Your comment </label><em>(required)</em>
    	<span class="error">[[!+fi.error.contact_message]]</span><br /> 
    	<textarea id="contact_message" class="required" name="contact_message" rows="7" cols="70">[[!+fi.contact_message]]</textarea>
    </div>
    <div>
    	<input class="submit" type="submit" name="submit" value="Submit" />
    </div>
    </form>
      • 10208 ☆ A M B ☆
      • 1,780 Posts
      Make your validator match the name of your input. i.e.

      &validate=`contact_email:email:required`


      Should be:

      &validate=`contact_email:required`


      seen here:
      <input id="contact_email" class="required email" type="text" name="contact_email" value="[[!+fi.contact_email]]" size="30" />


      Also, the most likely reason your cache doesn't completely clear is because you're doing it from the manager, and thus recreating cache files simply by using the manager. Clear your core/cache files through FTP (SLOW! - not recommended) or via your server's file manager instead.

        Frogabog- MODX Websites in Portland Oregon
        "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
        Having server issues? These guys have MODX Hosting perfected - SkyToaster
        • 44312
        • 9 Posts
        Quote from: frogabog at Jul 02, 2013, 08:04 PM
        Make your validator match the name of your input. i.e.

        &validate=`contact_email:email:required`


        Should be:

        &validate=`contact_email:required`


        seen here:
        <input id="contact_email" class="required email" type="text" name="contact_email" value="[[!+fi.contact_email]]" size="30">


        Also, the most likely reason your cache doesn't completely clear is because you're doing it from the manager, and thus recreating cache files simply by using the manager. Clear your core/cache files through FTP (SLOW! - not recommended) or via your server's file manager instead.


        I am not a professional at this, but I think the line I had was valid. :email is a validator that checks for a valid email. http://rtfm.modx.com/display/ADDON/FormIt.Validators#FormIt.Validators-BuiltInValidators Not only do I want it as a required field I want it to be in the format of a valid email address. Again the error points to a hook not being found. I deleted the core/cache/ folder completely and tried it all again, even with your above fix and still the same error.
          • 10208 ☆ A M B ☆
          • 1,780 Posts
          You're right, it is valid. I probably should have said try it without and see if it helps.

          OK, so now if the hook isn't being found, consider that files could be missing or corrupt. How did you install MODX? If you unpacked it locally, and FTP the files to the server, this is entirely possible. This is not to say it's not possible if you didn't use FTP, but just more possible.

          It's safe to re-install MODX any time, it can't hurt and often helps. So go ahead and run a reinstall, making sure to load a fresh copy of the zip file to the server itself, and unpack it there (as opposed to FTP). Follow the directions for upgrading MODX at http://rtfm.modx.com/display/revolution20/Upgrading+MODx

          Log out, clear the core/cache files, re-run setup.
            Frogabog- MODX Websites in Portland Oregon
            "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
            Having server issues? These guys have MODX Hosting perfected - SkyToaster
            • 44312
            • 9 Posts
            Quote from: frogabog at Jul 03, 2013, 02:37 AM
            You're right, it is valid. I probably should have said try it without and see if it helps.

            OK, so now if the hook isn't being found, consider that files could be missing or corrupt. How did you install MODX? If you unpacked it locally, and FTP the files to the server, this is entirely possible. This is not to say it's not possible if you didn't use FTP, but just more possible.

            It's safe to re-install MODX any time, it can't hurt and often helps. So go ahead and run a reinstall, making sure to load a fresh copy of the zip file to the server itself, and unpack it there (as opposed to FTP). Follow the directions for upgrading MODX at http://rtfm.modx.com/display/revolution20/Upgrading+MODx

            Log out, clear the core/cache files, re-run setup.

            Well I tried that and still the same thing. The error that I am getting seems to point to a problem in /index.php but that isn't even part of FormIt. I figured that maybe it was FormIt that had got broken somehow, but I tried to uninstall that and reinstall and still got the same problem. I wonder if uninstalling all my components before I re-run the upgrade procedure would help? Could it be a problem with PHP itself? I do not remember the error exactly, but when I was messing with the form and FormIt code I got a PHP error that I just dismissed. Ever since then I have not been able to get it to work. Since the error is in index.php it makes me wonder if something in PHP is corrupt and is not working correctly. Either I have made an error in my PHP.ini file or another file may be corrupt. Maybe a fresh PHP install might help.

            I should add that this is a server running on my local machine so I have access directly to the filesystem so no FTP issues could be involved.
              • 3109 ☆ A M B ☆
              • 894 Posts
              Instead of having it send an email change it to display a success message I think it might be working the problem is that you don't have a working email server on your localhost and it's giving you these bogus error messages because it can't send the email.
                Benjamin Marte
                Interactive Media Developer
                Follow Me on Twitter | Visit my site | Learn MODX
                • 44312
                • 9 Posts
                Quote from: benmarte at Jul 03, 2013, 08:49 AM
                Instead of having it send an email change it to display a success message I think it might be working the problem is that you don't have a working email server on your localhost and it's giving you these bogus error messages because it can't send the email.

                Well, I did some due diligence. I did as you said, I used the hook redirect and the param redirectTo=`2` which is a valid resource that I created called "success." The error is different this time, but still I get an error instead of the thing working. This is also on a brand new MODX install. I created another webpage in IIS and installed a fresh MODX 2.2.8 and then installed FormIt. Nothing else. Ran the old code and still got the same error. Changed it to a redirect as above and got this error
                [2013-07-03 10:00:01] (ERROR @ /index.php) ``2` ` is not a valid integer and may not be passed to makeUrl()
                [2013-07-03 10:03:08] (ERROR @ /index.php) ``/success.html` ` is not a valid integer and may not be passed to makeUrl()
                [2013-07-03 10:08:04] (ERROR @ /index.php) ``0` ` is not a valid integer and may not be passed to makeUrl()
                [2013-07-03 10:11:47] (ERROR @ /index.php) ``1` ` is not a valid integer and may not be passed to makeUrl()
                [2013-07-03 10:12:59] (ERROR @ /index.php) `` 1` ` is not a valid integer and may not be passed to makeUrl()
                [2013-07-03 10:16:43] (ERROR @ /index.php) ``2` ` is not a valid integer and may not be passed to makeUrl()

                as you can see I tried everything. I have two resources, Home (1) Success(2), the code I am using on 'submit' of the form
                [[!FormIt? 
                &hooks=`redirect`
                &redirectTo=`2` 
                ]]


                On top of all that, I did verify that my mail server was working. I could telnet in to the mail server and I also downloaded QuickEmail in MODX and installed that. The email was sent. It is not my mail server that is the issue. The issue is something else that spans across two modx installations that have nothing to do with each other. Anyone else before I email the author and beg for help?
                  • 10208 ☆ A M B ☆
                  • 1,780 Posts
                  It's entirely possible that IIS is the key word here. Have you tried all this on an Apache server? Could install XAMPP real quick, install MODX and attempt the same form. There are some round these parts that do know IIS and the possible troubles/fixes so maybe do some searching for formIt and IIS posts.

                  Seems I've forgotten to ask one of the most important first questions when issues arise which is, "Tell us about your environment please?"
                    Frogabog- MODX Websites in Portland Oregon
                    "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
                    Having server issues? These guys have MODX Hosting perfected - SkyToaster
                    • 44312
                    • 9 Posts
                    Quote from: frogabog at Jul 03, 2013, 01:55 PM
                    It's entirely possible that IIS is the key word here. Have you tried all this on an Apache server? Could install XAMPP real quick, install MODX and attempt the same form. There are some round these parts that do know IIS and the possible troubles/fixes so maybe do some searching for formIt and IIS posts.

                    Seems I've forgotten to ask one of the most important first questions when issues arise which is, "Tell us about your environment please?"

                    Steps to Reproduce: None

                    Expected Outcome: FormIt to work as it did when I first installed it


                    MODX Version: 2.2.8
                    PHP Version: 5.4
                    Database (MySQL, SQL Server, etc) Version: 5.6 community server
                    Additional Server Info: IIS 8.0
                    Installed MODX Add-ons: (1st virtual host)FormIt (2nd virtual host) articles and depend., FormIt, tinyMCe, wayfinder
                    Error Log Contents: see above

                    I have tried to do a new install of MODX on my server with the same issue. The problem seems to be that no matter the hook I try and use I get the same error stating that the requested FormIt hook is not found. This happens across two websites with separate installs of MODX and FormIt. I tried to reinstall MODX and FormIt with no solution. I have tried to clear the cache, same result. I have also went as far as to re-install PHP with a clean PHP.ini file with no success.

                    I am trying to think back about what I changed in the base AMP setup, but I can't think of anything. I was only working with MODX and FormIt when it decided to stop working.

                    There has to be a way to trace this and see exactly what call is failing. I emailed the guy who wrote FormIt. Really hoping he responds
                      • 9207 ☆ A M B ☆
                      • 2,475 Posts
                      I don't know if this will help: http://modx.com/extras/package/syntaxchecker
                      It's a plugin I wrote to help check the syntax of your MODX tags. It can catch a lot of the errors (missing brackets, misspelled Snippet name etc). I just released the new version.

                      There could be a bug in the Snippet itself...