$Database
$Database : \SmartDatabase
Provides javascript form validation rules for jQuery's Validation Plugin
A basic example (taken from testXml.php that comes with SmartDatabase):
<script type="text/javascript" src="/cirkuit/includes/js/jquery/core/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="/cirkuit/includes/js/jquery/plugins/validate/1.9.0/jquery.validate.min.js"></script>
<script type="text/javascript" src="/cirkuit/includes/js/jquery/plugins/validate/1.9.0/additional-methods.min.js"></script>
<script type="text/javascript">
$(function(){
//validate page properties form
$("form[name=test7]").validate({
<?
require_once(dirname(__FILE__)."/../FormValidation/SmartFormValidation_jQueryValidate.php");
$formValidation = new SmartFormValidation_jQuery($database);
$options = $formValidation->GetPluginOptions('Questionare');
?>
rules: <?=json_encode($options['rules'])?>,
messages: <?=json_encode($options['messages'])?>
});
});
</script>
<style type="text/css">
.error{
background-color:#FFD5D6;
border:1px dashed #CC0000;
}
label.error{
background:none;
border:none;
color: #cc0000;
font-size: 11px;
font-weight: bold;
margin-left: 1em;
}
</style>
$Database : \SmartDatabase
__construct(\SmartDatabase $Database) : \SmartTable
Constructor
\SmartDatabase | $Database | The Database that the validation rules will be created for |
GetPluginOptions(string $tableName = null, string $columnName = null) : array
Returns the jQuery Validation Plugin's options for the given scope as an assoc array of formObjectName=>array(pluginOption=>value)
string | $tableName | [optional] If set, returns ALL rules for the given $tableName OR optionally only the rule for the given $columnName |
string | $columnName | [optional] If set, returns the rule for the given $columnName within the given $Table |
All rules in the database OR optionally all rules for the given $tableName OR optionally only the rule for the given $columnName within the given $tableName