Forums

validation problem

ciccio 19 Jul, 2008
hello and thanks for this component, it's awesome!

I followed the video tutorial for the validation of all the fields, but does't work with my site, i use joomla 1.5.2 with php 4.1

First i tried with the php code to link the prototype.js and validation.js files; then i used the tag <src as you do in the tutorial, but nothing changed, maybe the problem is another.

This is the final code i have inside Form Html:

<script src="http://www.thebamby.com/components/com_chronocontact/prototype.js" type="text/javascript"></script><br>
<script src="http://www.thebamby.com/components/com_chronocontact/validation.js" type="text/javascript"></script>



  <p>
    <label class="label">Name</label>
    <input name="Name" type="text" class="field" value="" /> 
  </p>
  <p>
    <label><span class="label">Telephone</span></label>
    <input name="Telephone" type="text" class="field" value="" />
     </p>
  <p><label><span class="label">Email</span></label>
  <input name="email" type="text" class="field" value="" />
   </p><br />
    
 
  <label>invia
  <input type="submit" name="invia" id="invia" value="Invia" />
  </label>



 <script type="text/javascript" >
new Validation(this);
  function formCallback(result, form) {
    window.status = "validation callback for form '" + form.id + "': result = " + result;
}
var valid = new Validation('my_form', {immediate : true, onFormValidate : formCallback});

</script>



The form works fine, only te validation doesn't.

Can someone help me with this ?

thanks in advance
GreyHead 19 Jul, 2008
Hi ciccio,

Remove the validation code from your form code and use the Validation tab in the form manager instead and ChronoForms will handle everything else. (You also need to remove the class attributes from the input tags:
   <p> 
    <label class="label">Name</label> 
    <input name="Name" type="text" class="field" value="" />  
  </p> 
  <p> 
    <label><span class="label">Telephone</span></label> 
    <input name="Telephone" type="text" value="" /> 
     </p> 
  <p><label><span class="label">Email</span></label> 
  <input name="email" type="text" value="" /> 
   </p><br /> 
     
  
  <label>invia 
  <input type="submit" name="invia" id="invia" value="Invia" /> 
  </label> 
Bob
ciccio 20 Jul, 2008
Thank you very much, now it works perfectly!

Last thing,

how can i do to use css tag inside the field, i used class="field", but as you notice, doesn't works with the validation.

Thanks
Max_admin 20 Jul, 2008
You cant right now, alter your css to use the validation classes, the next version of Chronoforms will allow this though!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 21 Jul, 2008
Hi ciccio,

You can either put the validation classes in manually like class="field required" (if you do that, turn validation on but *don't* put the field names in the Validation tab);

Or you can use css selectors like form.input to identify the tags without using a class attribute.

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