CF3 old installation problem

lestatu2 13 Sep, 2012
Hi friend I have to work on an old CF3 installation with many forms not builded by me.

I have a problem:

1- If an user inserts not corrected captcha checkbox remains checked but it isn't checked ---->Button remain disabled (validation= no flagged checkbox---->send button disabled)

this is the link http://www.asteconsulting.com

HTML CODE
<style type="text/css">div.chronoform {display: none;}</style>
<div class="contenitore_formBanner">
<div class="form_item">
  <div class="form_elemento cf_textbox">
    <input class="content-box text field" maxlength="30" size="30" id="nominativo" name="nominativo" value="Nome e Cognome" type="text" onfocus="if(this.value == 'Inserire Nome e Cognome' || this.value == 'Nome e Cognome' ) this.value='';" onblur="valCognome(this)"/>
  </div>
  
  <div class="cfclear"> </div>
</div>

<div class="col_destra">
  <div class="form_elemento cf_textbox">
    <input class="content-box field" maxlength="15" size="30" id="telef" name="telef" value="Telefono" type="text" onfocus="if(this.value == 'Inserire il Numero di Telefono' || this.value == 'Telefono' ) this.value='';" onblur="valTel(this)" />
  </div>
  
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_elemento cf_textbox">
    <input class="content-box field" maxlength="50" size="30" id="posta" name="posta" value="Email" oncopy="return false" onpaste="return false" oncut="return false" type="text" onfocus="if(this.value == 'Inserire l\' email' || this.value == 'Email'  ) this.value='';" onblur="valEmail(this)" />
  </div> 

  <div class="cfclear"> </div>
</div>

<div class="col_destra">
  <div class="form_elemento cf_textbox">
    <input class="content-box field" maxlength="50" size="30" id="posta2" name="posta2" value="Conferma Email" oncopy="return false" onpaste="return false" oncut="return false" type="text" onfocus="if(this.value == 'Ripetere l\' email' || this.value == 'Conferma Email' ) this.value='';" onblur="valEmail2(this)" />
  </div>  
  <div class="cfclear"> </div>
</div>

<! ------------ CAPTCHA --------------- >
<div class="form_item">
  <div class="form_elemento">   
     
      <img id="captcha_imgBanner" alt="" src="/components/com_chronocontact/chrono_verification.php?imtype=1">
    
    <input type="text" class="content-box" value="" id="captchainputBanner" name="chrono_verification">

  </div>
  <div class="cfclear"> </div>
</div>
<! ------------ /CAPTCHA -------------- >

<! ------------ PRIVACY--------------- >
  <div class="pos_privacy">
      <input value="Privacy" title="" class="radio" id="check00" name="check0" type="checkbox" onClick="checkButton(this,button_banner)" />
      <label for="check00" class="check_label privacySLB">
<a style="text-decoration:none; letter-spacing:0px;" target="" href="index.php?option=com_content&view=article&id=282">
Consenso Privacy</a></label>
      <br />
  </div>


<! ------------ /PRIVACY-------------- >

<div class="form_item">
  <div class="form_elemento cf_button">
    <button type="submit" name="button_banner" value="Submit" id="bottone_infoBanner" class="bottone_infoBanner" disabled="disabled">
    </button>
  </div>
  <div class="cfclear"> </div>
</div>
</div>


JAVASCRIPT CODE
function valCognome(nome) {
 var nome= nome.value;
 if (nome== '' || (nome&& !nome.match(/^([a-zA-Z\ò\ì\ù\à\è'\' ']{5,30})$/)))
   document.getElementById('nominativo').value = "Inserire Nome e Cognome";
}

function valTel(telefono) {
 var tel = telefono.value;
 if (tel == '' || (tel && !tel.match(/^([0-9]{1,13})([/\-\ ]{0,1})([0-9]{0,10})$/))) 
   document.getElementById('telef').value = "Inserire il Numero di Telefono";
}

function valEmail(email) {
 var email = email.value;
 if (email == '' || (email && !email.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})$/))) 
   document.getElementById('posta').value = "Inserire l\' email";
}

function valEmail2(conferma_email) {
 var email2 = conferma_email.value;
 if (email2 == '' || (email2 && !email2.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})$/))) 
   document.getElementById('posta2').value = "Ripetere l\' email";
}




SERVER SIDE VALIDATION
<?php
$nome = JRequest::getString('nominativo','','post');         // CONTROLLO NOME
$pattern2 = '/^([a-zA-Z\ò\ì\ù\à\è\'\ ]{5,30})$/';
if ( !preg_match($pattern2, $nome) ){
  $messaggi[] = "Inserire un nome valido";
}

$telefono = JRequest::getString('telef','','post');    // CONTROLLO TELEFONO
$pattern6 = '#^([0-9]{1,13})([/\-\\s]{0,1})([0-9]{0,10})$#';
if ( !preg_match($pattern6, $telefono) ){
  $messaggi[] = "Inserire un n° di telefono valido";
}

$email = JRequest::getString('posta','','post');       // CONTROLLO EMAIL
$pattern1 = '/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})$/';
if ( !preg_match($pattern1, $email) ){
  $messaggi[] = "Inserire un indirizzo email valido";
}

$email2 = JRequest::getString('posta2','','post');  // CONTROLLO EMAIL2
if ( !preg_match($pattern1, $email2) ){
  $messaggi[] = "Inserire un indirizzo conferma email valido";
}

if ( strcmp( $email, $email2) != 0 ){
  $messaggi[] = "Le email inserite non coincidono";
}

// controlla se ci sono errori e li scrive a video
if ( count($messaggi))  {
  return implode('<br/>', $messaggi);
}

?>


Thanks however
GreyHead 14 Sep, 2012
Hi lestatu,

That has to be one of the worst web pages I've seen in a long time :-(

There are JavaScript errors from this script
<script type='text/javascript'>
var fieldsarray = new http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js();
var fieldsarray_count = 0;window.addEvent('domready', function() {
elementExtend();setValidation("ChronoContact_form_banner", 1, 0, 0);});</script>
<script type="text/javascript"> 
which are probably breaking other scripts on the page. But there are so many of them that I doubt you can ever get them to work well together :-(

Bob
lestatu2 14 Sep, 2012
I THINK THIS IS THE WORSTEST PAGE OF ALL TIME.....

I think is better to build a new site.......but I can't decide this....

Thanks however
GreyHead 14 Sep, 2012
Hi lestatu2 ,

:-) The client always knows best . . .

Bob
This topic is locked and no more replies can be posted.