hello,
I know this is a chronoforms forum, but since there is a liveValidation library used maybe you can help me:)
I have a field which need to be filled with one number from allowed, that's easy:
But the values will vary depending on the year i.e. in 2010 - { minimum: 2004, maximum: 2008 }, in 2011 - { minimum: 2005, maximum: 2009 } and so on. So i want it to be a little more dynamic:) I.ve found an sql function which would make it for me but unfortunately doesn't want to work:/
and
Query should look something like that, right?
How to put the result into apropriate place?
I'll be greatful for any help.
I know this is a chronoforms forum, but since there is a liveValidation library used maybe you can help me:)
I have a field which need to be filled with one number from allowed, that's easy:
<?php
$script = "
var wiek_1 = new LiveValidation('wiek_1');
wiek_1.add(Validate.Presence, { failureMessage: 'Data urodzenia jest wymagana!' });
wiek_1.add(Validate.Numericality, { minimum: 2003, maximum: 2007, failureMessage: 'Zła data urodzenia' });
";
$script = "
window.addEvent('domready', function() {
$script
});
";
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration($script);
?>
But the values will vary depending on the year i.e. in 2010 - { minimum: 2004, maximum: 2008 }, in 2011 - { minimum: 2005, maximum: 2009 } and so on. So i want it to be a little more dynamic:) I.ve found an sql function which would make it for me but unfortunately doesn't want to work:/
SELECT YEAR(DATE_SUB(CURDATE(), INTERVAL 6 YEAR));
and
SELECT YEAR(DATE_SUB(CURDATE(), INTERVAL 2 YEAR));
Query should look something like that, right?
<?php
$db =& JFactory::getDBO();
$query = "
SELECT YEAR( DATE_SUB( CURDATE( ) , INTERVAL 6 YEAR ) ) ;
";
$db->setQuery($query);
$wynik = $db->loadResultArray();
?>
How to put the result into apropriate place?
I'll be greatful for any help.