Workin' on a Form Validation solution...
as I said I would like to implement the form validation into CP, in order to be able to check what the user are entering IE: if a field requires a email address, email address must be!
So I've been watching around the code of CP, and i've been surprised from the presence of the jquery.validate.js
plugin. So I started to wonder how could be possible to imprement this plugin with the form that users are using to add new ads!
This plugin is very useful because it let you set the kind of validation for each field simply by adding or removing classes to the object. I thought it could be cool to implement this functionality in CP so I started to edit some core files of the template.
I went accross the valiable $options_new_field
inside the file admin-values.php
. In here I added another array with the following options:
array( 'name' => __('Validazione Campo', 'cp'),
'desc' => '',
'tip' => __('Selezionare se è necessario attivare gli strumenti di validazione per questo campo, successivamente sará possibile selezionare quale/i validazioni prendere in considerazione.'),
'id' => 'field_validation',
'css' => 'min-width: 400px;',
'type' => 'checkbox',
'req' => '',
'vis' => '',
I would like to add a list of checkboxes with different values, one for each class used by the plugin, but in the file is not clear how to create multiple checkboxes...
Anyone of you has got any idea?