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