This bug 4553 was solved, added a parameter defaultvalue, this property is working

This commit is contained in:
Carlos Pacha
2011-01-27 22:34:53 +00:00
parent 8fc53ed051
commit 345f3d9f7b
2 changed files with 15 additions and 5 deletions

View File

@@ -171,9 +171,18 @@ var G_Grid = function(oForm, sGridName) {
var aux = oNewRow.getElementsByTagName('td')[i].innerHTML;
}
//alert(aObjects[0].name);
if (aObjects[0].type != 'checkbox') {
tags = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('a');
if( tags.length == 0 ){ //then it is a datepicker
scriptTags = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('script');
attributes = elementAttributesNS(aObjects[0], 'pm');
if(attributes.defaultvalue!= undefined)
attributDefaultValue=attributes.defaultvalue;
}
if (aObjects[0].type != 'checkbox' ) {
if(attributDefaultValue!='')
aObjects[0].value = attributDefaultValue;
else
aObjects[0].value = '';
} else {
aObjects[0].checked = false;

View File

@@ -907,11 +907,12 @@ class XmlForm_Field_Text extends XmlForm_Field_SimpleText
$v = G::replaceDataField ( $v, $owner->values );
}
$aux [$r] = $v;
$v =($v!='')?$v:$this->defaultValue;
if ($this->mode === 'edit') {
if ($this->readOnly)
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '" required="' . $isRequired . '" readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '"/>';
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '" required="' . $isRequired . '" readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" pm:defaultvalue="'.$this->defaultValue.'"/>';
else
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '" required="' . $isRequired . '" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '"/>';
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '" required="' . $isRequired . '" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" pm:defaultvalue="'.$this->defaultValue.'"/>';
} elseif ($this->mode === 'view') {
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '" required="' . $isRequired . '" style="display:none;' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '"/>' . htmlentities ( $v, ENT_COMPAT, 'utf-8' );
} else {