FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
500 Error after adding Captcha
#1
This is a bit of an emergency as I need to get this launched today if possible.

I have multiple forms on a page and have employed the namespace function from the api to get this functioning. All was fine until I tried to add Captcha to each of the forms. This too was OK until I tried to solve the problem with fields being lost if the entry to the Captcha was wrong. Now I am getting a 500 error, even after removing all of the Captcha code.

While I have several forms on the page, I will just add code from two of them to show you what I have. If ANYONE has a suggestion of first, how to get rid of this 500 error and then, getting Captcha working in my scenario, I would appreciate it GREATLY.

Code:
<?php
require_once("/web/home/assets/scripts/formtools/global/api/api.php");
$pp9["mode"] = "live";
$pp10["mode"] = "live";

$fields_9 = ft_api_init_form_page(9, "live", "form_tools_form_9");
$fields_10 = ft_api_init_form_page(10, "live", "form_tools_form_10");

if(isset($_POST['v-docSubmit'])) {
    if ($pp9["mode"] == "initialize") {
        $params = array(
            "namespace" => "form_tools_form_9",
            "submit_button" => "v-docSubmit",
            "next_page" => "entry-thanks.php",
            "form_data" => $_POST,
            "finalize" => true
        );
    } else {
        ft_api_start_sessions();
        $fields = isset($_SESSION["form_tools_form_data"]) ? ft_strip_tags($_SESSION["form_tools_form_data"]) : array();
        $params = array(
            "namespace" => "form_tools_form_9",
            "submit_button" => "v-docSubmit",
            "next_page" => "entry-thanks.php",
            "form_data" => $_POST,
            "finalize" => true            
        );        
    }
    ft_api_process_form($params);
} elseif (isset($_POST['vd-Submit'])) {
    if ($pp10["mode"] == "initialize") {
        $params = array(
            "namespace" => "form_tools_form_10",
            "submit_button" => "vd-Submit",
            "next_page" => "entry-thanks.php",
            "form_data" => $_POST,
            "finalize" => true
        );
    } else {
        $params = array(
            "namespace" => "form_tools_form_10",
            "submit_button" => "vd-Submit",
            "next_page" => "entry-thanks.php",
            "form_data" => $_POST,
            "finalize" => true        
        );
    }
    ft_api_process_form($params);
}

// Forms //
<div id="video_documentary">
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="post" class="clean" id="v_doc">
          <ol>
            <li>
              <fieldset>
                <legend>Video Documentary</legend>
                <ol>
                  <li>
                    <label for="runtime">Run Time</label>
                    <input type="text" id="runtime" name="runtime" value="<?=htmlspecialchars(@$fields["runtime"])?>" />
                  </li>
                  <li>
                    <label for="title">Production Title</label>
                    <input type="text" id="title" name="title" value="<?=htmlspecialchars(@$fields["title"])?>" />
                  </li>
                  <li>
                    <label for="main_student_producer">Main Student Producer's Name</label>
                    <input type="text" id="main_student_producer" name="main_student_producer" value="<?=htmlspecialchars(@$fields["main_student"])?>" />
                  </li>
                  <li>
                    <label for="main_student_prod_email">Main Student Producer's Email</label>
                    <input type="text" id="main_student_prod_email" name="main_student_prod_email" value="<?=htmlspecialchars(@$fields["main_student_prod_email"])?>" />
                  </li>
                  <li>
                    <label for="second_producer">Second Producer</label>
                    <input type="text" id="second_producer" name="second_producer" value="<?=htmlspecialchars(@$fields["second_producer"])?>" />
                  </li>
                  <li>
                    <label for="second_producer_email">Second Producers Email</label>
                    <input type="text" id="second_producer_email" name="second_producer_email" value="<?=htmlspecialchars(@$fields["second_producer_email"])?>" />
                  </li>
                  <li>
                    <label for="third_producer">Third Producer</label>
                    <input type="text" id="third_producer" name="third_producer" value="<?=htmlspecialchars(@$fields["third_producer"])?>" />
                  </li>
                  <li>
                    <label for="third_producer_email">Third Producer's Email</label>
                    <input type="text" id="third_producer_email" name="third_producer_email" value="<?=htmlspecialchars(@$fields["third_producer_email"])?>" />
                    
                  </li>
                  <li>
                    <label for="fourth_producer">Fourth Producer</label>
                    <input type="text" id="fourth_producer" name="fourth_producer" value="<?=htmlspecialchars(@$fields["fourth_producer"])?>" />
                  </li>
                  <li>
                    <label for="fourth_producer_email">Fourth Producer's Email</label>
                    <input type="text" id="fourth_producer_email" name="fourth_producer_email" value="<?=htmlspecialchars(@$fields["fourth_producer_email"])?>" />
                  </li>
                  <li>
                    <label for="synopsis">Brief Synopsis of the Production</label>
                    <textarea name="synopsis" rows="6" id="synopsis"><?=htmlspecialchars(@$fields["synopsis"])?>
                    </textarea>
                  </li>
                  <li>
                    <label for="institution">Name of Institution</label>
                    <input type="text" id="institution" name="institution" value="<?=htmlspecialchars(@$fields["institution"])?>" />
                    
                  </li>
                  <li>
                    <label for="program">Program</label>
                    <input type="text" id="program" name="program" value="<?=htmlspecialchars(@$fields["program"])?>" />
                  </li>
                  <li>
                    <label for="faculty_contact">Faculty or School Contact</label>
                    <input type="text" id="faculty_contact" name="faculty_contact" value="<?=htmlspecialchars(@$fields["faculty_contact"])?>" />
                  </li>
                  <li>
                    <label for="faculty_email">Faculty Email</label>
                    <input type="text" id="faculty_email" name="faculty_email" value="<?=htmlspecialchars(@$fields["faculty_email"])?>" />
                  </li>
                  <li><?php ft_api_display_post_form_captcha_error(); ?><br /><?php ft_api_display_captcha(); ?></li>
                </ol>
              </fieldset>
            </li>
          </ol>
          <p style="text-align:right;">
            <input type="reset" value="CANCEL" />
            <input type="submit" value="OK" name="v-docSubmit"/>
          </p>
        </form>
      </div><!-- end Documentary -->
      <div class="show" id="video_drama" >
        <form action="<?php echo $_SERVER["PHP_SELF"]?>" class="clean" id="v_drama" method="post">
          <ol>
            <li>
              <fieldset>
                <legend>Video Drama</legend>
                <ol>
                  <li>
                    <label for="runtime-vd">Run Time</label>
                    <input type="text" id="runtime-vd" name="runtime-vd" value="" />
                  </li>
                  <li>
                    <label for="title-vd">Production Title</label>
                    <input type="text" id="title-vd" name="title-vd" value="" />
                  </li>
                  <li>
                    <label for="main_student_producer-vd">Main Student Producer's Name</label>
                    <input type="text" id="main_student_producer-vd" name="main_student_producer-vd" value="" />
                  </li>
                  <li>
                    <label for="main_student_prod_email-vd">Main Student Producer's Email</label>
                    <input type="text" id="main_student_prod_email-vd" name="main_student_prod_email-vd" value="" />
                  </li>
                  <li>
                    <label for="second_producer-vd">Second Producer</label>
                    <input type="text" id="second_producer-vd" name="second_producer-vd" value="" />
                  </li>
                  <li>
                    <label for="second_producer_email-vd">Second Producers Email</label>
                    <input type="text" id="second_producer_email-vd" name="second_producer_email-vd" value="" />
                  </li>
                  <li>
                    <label for="third_producer-vd">Third Producer</label>
                    <input type="text" id="third_producer-vd" name="third_producer-vd" value="" />
                  </li>
                  <li>
                    <label for="third_producer_email-vd">Third Producer's Email</label>
                    <input type="text" id="third_producer_email-vd" name="third_producer_email-vd" value="" />
                  </li>
                  <li>
                    <label for="fourth_producer-vd">Fourth Producer</label>
                    <input type="text" id="fourth_producer-vd" name="fourth_producer-vd" value="" />
                  </li>
                  <li>
                    <label for="fourth_producer_email-vd">Fourth Producer's Email</label>
                    <input type="text" id="fourth_producer_email-vd" name="fourth_producer_email-vd" value="" />
                  </li>
                  <li>
                    <label for="synopsis-vd">Brief Synopsis of the Production</label>
                    <textarea name="synopsis-vd" rows="5" id="synopsis-vd"></textarea>
                  </li>
                  <li>
                    <label for="institution-vd">Name of Institution</label>
                    <input type="text" id="institution-vd" name="institution-vd" value="" />
                  </li>
                  <li>
                    <label for="program-vd">Program</label>
                    <input type="text" id="program-vd" name="program-vd" value="" />
                  </li>
                  <li>
                    <label for="faculty_contact-vd">Faculty or School Contact</label>
                    <input type="text" id="faculty_contact-vd" name="faculty_contact-vd" value="" />
                  </li>
                  <li>
                    <label for="faculty_email-vd">Faculty Email</label>
                    <input type="text" id="faculty_email-vd" name="faculty_email-vd" value="" />
                  </li>
                </ol>
              </fieldset>
            </li>
          </ol>
          <p style="text-align:right;">
            <input type="reset" value="CANCEL" />
            <input type="submit" value="OK" name="vd-Submit" />
          </p>
        </form>
      </div><!-- end drama -->

OK .. sorry for the noise. I had removed some forms from the formtools admin and on the page in question, I still had some calls to some of the forms I had deleted ... which was causing this error.

Thanks

Dave
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)