From efd1860a91c02c10e42d521bd28f504cce40ac93 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 21 Nov 2009 12:11:45 +1100 Subject: [PATCH] SF Bug #2554402 - template autofill command not work on appearance,date_attrs --- htdocs/js/date_selector.js | 2 +- lib/PageRender.php | 2 +- lib/TemplateRender.php | 14 ++++++++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/js/date_selector.js b/htdocs/js/date_selector.js index 40c54f7..eed89d6 100644 --- a/htdocs/js/date_selector.js +++ b/htdocs/js/date_selector.js @@ -1,5 +1,5 @@ function dateSelector(id) { - var el = document.getElementById('f_date_'+id); + var el = document.getElementById('new_values_'+id); var format = gettype(el.id); var epoch; var parse = false; diff --git a/lib/PageRender.php b/lib/PageRender.php index dbca6fb..6dbb1bc 100644 --- a/lib/PageRender.php +++ b/lib/PageRender.php @@ -702,7 +702,7 @@ class PageRender extends Visitor { $val = $attribute->getValue($i); echo ''; - printf(' ', + printf(' ', $attribute->getName(),$i, htmlspecialchars($attribute->getName()),$i,htmlspecialchars($val), $attribute->needJS('focus') ? sprintf('onFocus="focus_%s(this);" ',$attribute->getName()) : '', diff --git a/lib/TemplateRender.php b/lib/TemplateRender.php index b666e8f..7cba696 100644 --- a/lib/TemplateRender.php +++ b/lib/TemplateRender.php @@ -1852,14 +1852,16 @@ function fillRec(id,value) { if ($attribute->needJS('blur')) { printf('function blur_%s(component) {',$attribute->getName()); echo "\n"; +//echo ' alert("BLUR: ID:"+component.id+", V:"+pla_getComponentValue(component));'; $this->draw('BlurJavascript',$attribute,'component'); echo "};\n"; } echo '// validate'."\n"; + printf('function validate_%s(component,silence) {',$attribute->getName()); + echo "\n"; + if ($attribute->needJS('validate')) { - printf('function validate_%s(component,silence) {',$attribute->getName()); - echo "\n"; echo ' var valid = true;'; echo "\n"; $this->draw('ValidateJavascript',$attribute,'component','silence','valid'); @@ -1867,9 +1869,13 @@ function fillRec(id,value) { echo ' if (valid) { component.style.backgroundColor = "white"; component.style.color = "black"; }'; echo ' else { component.style.backgroundColor = \'#FFFFA0\'; component.style.color = "black"; }'; echo ' return valid;'; - echo '}'."\n"; + + } else { + echo ' return true;'."\n"; } + echo '}'."\n"; + echo ''."\n"; printf('',__METHOD__,$attribute->getName()); @@ -2232,7 +2238,7 @@ function deleteAttribute(attrName,friendlyName,i) $config['format'] = $config['date'][$attribute->getName()]; for ($i=0;$i<=$attribute->getValueCount();$i++) { - printf('',$attribute->getName(),$i,$config['format']); + printf('',$attribute->getName(),$i,$config['format']); if (in_array_ignore_case($attribute->getName(),array_keys($config['time'])) && ($config['time'][$attribute->getName()])) printf('',$attribute->getName(),$i,'true');