2

I have a survey on a website (WordPress, zenith template) and I have a problem submitting the form. I get an error saying "Uncaught Reference Error". Can someone help me fix this problem?

Screenshot from the moment y click SEND button

The survey address is here

<?php  
/* 
Template Name: Cuestionario OQ ingles
*/  
get_header(); 
global $PAGE_ID;
$options = get_option('infinite_options');
?>

<?php while ( have_posts() ) : the_post(); 
$featured_image_array = wp_get_attachment_image_src( get_post_thumbnail_id(), 'single-post-thumbnail' ); 
$featured_image = $featured_image_array[0];
$sidebar = get_post_meta(get_the_ID(), SYSTEM_VAR_PREFIX."select_sidebar", true);

if ($sidebar)
{
?> 
    <div id="inner-content">
<?php
}
else
{
?>
    <div class="one">
<?php
}

if ($featured_image != "")
{
?> 
<p><img src="<?php echo $featured_image; ?>" alt=""></p>
<?php
}
the_content();
?>
<!--Inicio todo el documento-->
<div id="contenedor">
<!--Inicio del Contenido-->

<div id="contenido">
  <table border="0" align="center" cellpadding="0" cellspacing="0" id="textocontenido">
    <tr>
      <td >&nbsp;</td>
      </tr>
    <tr>
      <td >
 <center>     
      
      <?php
if (!$HTTP_POST_VARS){ } 
?>


<form action="<?php bloginfo('template_url'); ?>/procesa_oq_ingles.php" method=post> 
<table  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="7" colspan="6" align="center" bgcolor="#CCCCCC">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="6" align="center">&nbsp;</td>
        </tr>
        <tr>
          <td height="14" colspan="6" align="center">Outcomes Questionnaire (OQ-45.2)</td>
        </tr>
        <tr>
          <td height="7" colspan="6"><hr /></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td colspan="4">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="right">Name:</td>
          <td colspan="4"><label>
            <input type="text" name="nombre" id="textfield">
          </label></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="right">Age:</td>
          <td colspan="4"><input type="text" name="edad" id="textfield2"></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="right">E-Mail:</td>
          <td colspan="4"><input type="text" name="correo" id="textfield3"></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="right">&nbsp;</td>
          <td colspan="4">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td colspan="6">Instructions: Looking back over the last week, including today, help us understand how you have been feeling.</td>
        </tr>
        <tr>
          <td align="right">&nbsp;</td>
          <td colspan="4">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td width="131" height="23" align="center">Never</td>
          <td width="87" align="center">Rarely</td>
          <td width="86" align="center">Sometimes</td>
          <td width="97" align="center">Frequently</td>
          <td width="121" align="center">Almost Always</td>
        </tr>


<!-- FIRST QUESTION -->

        <tr>
          <td width="382">1.  I get along well with others.</td>
          <td colspan="5" align="center"><table width="430" height="25" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td width="86" align="center"><label>
                <input type="radio" name="RadioGroup1" value="4" id="RadioGroup1_0" />
              </label></td>
              <td width="86" align="center"><label>
                <input type="radio" name="RadioGroup1" value="3" id="RadioGroup1_1" />
              </label></td>
              <td width="86" align="center"><label>
                <input type="radio" name="RadioGroup1" value="2" id="RadioGroup1_2" />
              </label></td>
              <td width="86" align="center"><label>
                <input type="radio" name="RadioGroup1" value="1" id="RadioGroup1_3" />
              </label></td>
              <td width="86" align="center"><label>
                <input type="radio" name="RadioGroup1" value="0" id="RadioGroup1_4" />
              </label></td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td colspan="6"><hr /></td>
        </tr>
        
<!-- LAST QUESTION -->

        <tr>
          <td height="12" valign="top" class="Estilo4">45.  I have headaches.</td>
          <td colspan="5" align="center"><table width="430" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td width="86" align="center"><label>
                <input type="radio" name="RadioGroup45" value="0" id="RadioGroup45_0" />
              </label></td>
              <td width="86" align="center"><label>
                <input type="radio" name="RadioGroup45" value="1" id="RadioGroup45_1" />
              </label></td>
              <td width="86" align="center"><label>
                <input type="radio" name="RadioGroup45" value="2" id="RadioGroup45_2" />
              </label></td>
              <td width="86" align="center"><label>
                <input type="radio" name="RadioGroup45" value="3" id="RadioGroup45_3" />
              </label></td>
              <td width="86" align="center"><label>
                <input type="radio" name="RadioGroup45" value="4" id="RadioGroup45_4" />
              </label></td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td height="2" colspan="6" valign="top" class="Estilo4"><hr /></td>
        </tr>
        <tr>
          <td colspan="6" valign="top" class="Estilo4">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="6" align="center"><input type=submit value="Send" onClick="ValidaMail(correo)"></td>
        </tr>
        <tr>
          <td colspan="6" align="center">&nbsp;</td>
        </tr>
      </table>
</form>
   
      
     </center> </td>
      </tr>
    <tr>
      <td>&nbsp;</td>
      </tr>
  </table>
</div>

<!--Fin del Contenido-->

</div>

<!--Fin todo el documento-->
    </div><!--END ONE-->
<?php
if (get_post_meta(get_the_ID(), SYSTEM_VAR_PREFIX."add_class_title", true) != "no")
{
?>
<script type='text/javascript'>
jQuery(document).ready(function($){
    $(".one :header, #inner-content :header").addClass("title");
    $(".team-member-info :header, .no_title").removeClass("title");
    $(".pricing-info :header, .no_title").removeClass("title");
})    
    
</script>
<?php
} 

if ($sidebar) get_sidebar(); 

?>

<?php endwhile; // end of the loop. ?> 
        
<?php get_footer(); ?>
            

So this is my code. It is supposed to go to procesa_oq_ingles.php but this doesn´t happen due the error appearing in the console.

I tried clearing the onclick event, but there was no change after that. Maybe someone has an idea what I can do to correct this?

Thanks...

Hillel
  • 811
  • 2
  • 7
  • 19
  • The Uncaught Reference Error comes from a JavaScript file, where something called `ValidaMail` should exist but doesn't. If that is a typo and maybe should be ValidMail, that could explain it. Otherwise, you need to define what ValidaMail is, which could mean including another .js file above. Regardless, the PHP code does not contain the answer to what is wrong, but looking at line 1368 of index.js which is reporting that error may give you more insight. You should be able to click the `index:1368` underlined link in your JavaScript console to view the code. – VictorB Oct 27 '20 at 17:54
  • Thank you so much @VictorB I check for the index.js file but doesn´t exist on the server... – Sebastián Contreras Oct 27 '20 at 18:08

0 Answers0