Forums

Use validation in Custom code form

Quevi2008 16 Mar, 2013
Hi,

I'm trying to use JS validation for several field in a custom code.

If I click on the forms name and afterwards on tab [JS Validation] I have these details:
- Enable JS Validation: YES
- Validation Errors: FIELD TITLES

For the required fields, I've added the TITLE tag:
<input title="Vul svp en naam in" type="text" name="naam" id="naam" />

I'm using:
- Joomla 2.5.9
- Chronforms 4.0 RC3.5.2

Validation is not working. If I take a look at the source code, i cannot find any validation.js file...

Can someone please help me out.

You can see the form http://www.patricksmulders.nl/nieuw/index.php/contactformulier
GreyHead 17 Mar, 2013
Hi Quevi2008,

The validation is enabled by setting classes in the inputs e.g. class='validate[required]'

You can see what the classes are by looking at the HTML for a test form created by the Wizard.

Bob
Quevi2008 17 Mar, 2013
I've added a new form with the Form Wizard.

Required field work fin in this wizard form.

I've added the
class="validate['required']"
to my required fields...

Unfortunately, this doesn't solve the problem.

Afterwards, I've read the source code of both pages. The Wizard Form adds a few Javascript files to the HEAD section (code below). the Custom Form doesn't add this code to the head section. Do I need to activate something else?

  <script src=".../components/com_chronoforms/js/formcheck/formcheck-yui.js" type="text/javascript"></script>
  <script src=".../components/com_chronoforms/js/formcheck/formcheck-max.js" type="text/javascript"></script>
  <script src=".../components/com_chronoforms/js/formcheck/lang/nl.js" type="text/javascript"></script> 
GreyHead 18 Mar, 2013
Hi Quevi2008,

Those files 'should' be automatically loaded if you have checked the Use Validation box, or you have 'validate[' anywhere in your Form HTML.

I'm not clear why that wouldn't work for you. Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.

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