BUG 8334 was added to the grid the functionality of checkbox
This commit is contained in:
@@ -308,8 +308,11 @@ var G_Grid = function(oForm, sGridName){
|
||||
}
|
||||
break;
|
||||
case 'checkbox': //CHECKBOX
|
||||
attributesFalse = elementAttributesNS(aObjects[0], '');
|
||||
if((defaultValue === attributesFalse.falsevalue) || (defaultValue===''))
|
||||
aObjects[n].checked = false;
|
||||
aObjects[n].value = defaultValue;
|
||||
else
|
||||
aObjects[n].checked = true;
|
||||
break;
|
||||
case 'hidden': //HIDDEN
|
||||
if ((attributes.gridtype != 'yesno' && attributes.gridtype != 'dropdown') || typeof attributes.gridtype == 'undefined')
|
||||
|
||||
@@ -316,6 +316,7 @@ class Form extends XmlForm
|
||||
break;
|
||||
|
||||
case 'checkgroup':
|
||||
|
||||
case 'listbox':
|
||||
if ( is_array($newValues[$k]) ) {
|
||||
$values[$k] = $values["{$k}_label"] = '';
|
||||
@@ -534,13 +535,25 @@ class Form extends XmlForm
|
||||
function validateFields($data) {
|
||||
$values = array();
|
||||
$excludeTypes = array('submit', 'file');
|
||||
|
||||
foreach($this->fields as $k => $v) {
|
||||
if (!in_array($v->type, $excludeTypes)) {
|
||||
switch($v->type) {
|
||||
case 'checkbox':
|
||||
$data[$v->name] = isset($data[$v->name])? $data[$v->name] : $v->falseValue;
|
||||
break;
|
||||
case 'grid':
|
||||
$i = 0 ;
|
||||
foreach ($data[$v->name] as $dataGrid) {
|
||||
$i++;
|
||||
foreach ($v->fields as $dataGridInt) {
|
||||
switch($dataGridInt->type) {
|
||||
case 'checkbox':
|
||||
$data[$v->name][$i][$dataGridInt->name] = isset($data[$v->name][$i][$dataGridInt->name])? $data[$v->name][$i][$dataGridInt->name] : $dataGridInt->falseValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2398,17 +2398,24 @@ class XmlForm_Field_Checkbox extends XmlForm_Field
|
||||
$r = 1;
|
||||
foreach ( $values as $v ) {
|
||||
$checked = (($v == $this->value) ? 'checked="checked"' : '');
|
||||
if($this->readOnly==='readonly' or $this->readOnly==='1' ){
|
||||
if($this->readOnly==='readonly' or $this->readOnly==='1' ) {
|
||||
$disabled = "disabled";
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$disabled = '';
|
||||
}
|
||||
//$disabled = (($this->value == 'view') ? 'disabled="disabled"' : '');
|
||||
$html = $res = "<input id='form[" . $owner->name . "][" . $r . "][" . $this->name . "]' value='{$this->value}' name='form[" . $owner->name . "][" . $r . "][" . $this->name . "]' type='checkbox' $checked $disabled readonly = '{$this->readOnly}' ".$this->NSDefaultValue()." ".$this->NSGridType()."/>";
|
||||
if ($this->mode==='edit') {
|
||||
$html = $res = "<input id='form[" . $owner->name . "][" . $r . "][" . $this->name . "]' value='{$this->value}' falseValue= ".$this->falseValue." name='form[" . $owner->name . "][" . $r . "][" . $this->name . "]' type='checkbox' $checked $disabled readonly = '{$this->readOnly}' ".$this->NSDefaultValue()." ".$this->NSGridType()."/>";
|
||||
$result [] = $html;
|
||||
$r ++;
|
||||
}
|
||||
else {
|
||||
//$disabled = (($this->value == 'view') ? 'disabled="disabled"' : '');
|
||||
$html = $res = "<input id='form[" . $owner->name . "][" . $r . "][" . $this->name . "]' value='{$this->value}' falseValue= ".$this->falseValue." name='form[" . $owner->name . "][" . $r . "][" . $this->name . "]' type='checkbox' $checked disabled readonly = '{$this->readOnly}' ".$this->NSDefaultValue()." ".$this->NSGridType()."/>";
|
||||
$result [] = $html;
|
||||
$r ++;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -32,12 +32,10 @@
|
||||
<yesno type="toolButton" class="ss_sprite button_toolbar ss_yesno" onclick="fieldsAdd('yesno')" buttonType="class">
|
||||
<en>Yes/No</en>
|
||||
</yesno>
|
||||
<!--.-->
|
||||
<!--<separator5 type="toolButton" file="images/dynamicForm/separatorTable.gif" home="public_html" buttonStyle=""/>
|
||||
<checkbox type="toolButton" onclick="fieldsAdd('checkbox')" file="images/dynamicForm/checkbox.gif" fileAlt="images/dynamicForm/hover.gif" home="public_html" buttonType="html">
|
||||
<en><![CDATA[<div class="ss_sprite button_toolbar ss_check" title="Checkbox"></div>]]></en>
|
||||
</checkbox>-->
|
||||
<!--.-->
|
||||
<separator5 type="toolButton" file="images/dynamicForm/separatorTable.gif" home="public_html" buttonStyle=""/>
|
||||
<checkbox type="toolButton" class="ss_sprite button_toolbar ss_check" onclick="fieldsAdd('checkbox')" buttonType="class">
|
||||
<en>Checkbox</en>
|
||||
</checkbox>
|
||||
<separator7 type="toolButton" file="images/dynamicForm/separatorTable.gif" home="public_html" buttonStyle=""/>
|
||||
<date type="toolButton" class="ss_sprite button_toolbar ss_date" onclick="fieldsAdd('date')" buttonType="class">
|
||||
<en>Date</en>
|
||||
|
||||
Reference in New Issue
Block a user