diff --git a/gulliver/js/form/core/form.js b/gulliver/js/form/core/form.js index 75d6b58b3..522eb477e 100755 --- a/gulliver/js/form/core/form.js +++ b/gulliver/js/form/core/form.js @@ -192,7 +192,20 @@ function G_Field ( form, element, name ) var oAux2 = oAux.getElementByName(row, newcont[i].name); if (oAux2) { oAux2.setValue(newcont[i].value); - oAux2.setContent(newcont[i].content); + + if (oAux2.element.type != "textarea") { + oAux2.setContent(newcont[i].content); + } else { + //This code fragment is copy of method G_Text.setContent() + oAux2.element.value = ""; + + if (newcont[i].content.options) { + if (newcont[i].content.options[0]) { + oAux2.element.value = newcont[i].content.options[0].value; + } + } + } + oAux2.updateDepententFields(); // this line is also needed to trigger the onchange event to trigger the calculation of // sumatory or average functions in text fields diff --git a/gulliver/js/maborak/core/maborak.js b/gulliver/js/maborak/core/maborak.js index 7ef5ba2e0..3e38fa51c 100644 --- a/gulliver/js/maborak/core/maborak.js +++ b/gulliver/js/maborak/core/maborak.js @@ -965,7 +965,8 @@ for(i=0;i-1){var arrayAux=oAux.name.split("][");grid=arrayAux[0];row=parseInt(arrayAux[1]);fieldName=arrayAux[2];gridField=gridGetAllFieldAndValue(oAux.name,0);if(Fields.length>0){aux=Fields;aux.push('?');if(aux.join('*').indexOf(fieldName+'*')==-1){Fields.push(fieldName);eval("var oAux2 = {"+fieldName+":'"+oAux.value()+"'}");fields=fields.concat(oAux2);}}else{Fields.push(fieldName);eval("var oAux2 = {"+fieldName+":'"+oAux.value()+"'}");fields=fields.concat(oAux2);}} else{aux=Fields;aux.push('?');oAux=me.dependentFields[i].dependentOf[0];if(Fields.length>0){if(aux.join('*').indexOf(oAux.name+'*')==-1){Fields.push(oAux.name);fields=fields.concat(me.dependentFields[i].dependentOf);}}else{Fields.push(oAux.name);fields=fields.concat(me.dependentFields[i].dependentOf);}}}}} var callServer;callServer=new leimnud.module.rpc.xmlhttp({url:me.form.ajaxServer,async:false,method:"POST",args:"function=reloadField"+"&form="+encodeURIComponent(me.form.id)+"&fields="+encodeURIComponent(fields.toJSONString())+((grid!="")?"&grid="+grid+((gridField!="")?"&gridField="+encodeURIComponent("{"+gridField+"}"):""):"")+((row>0)?"&row="+row:"")});callServer.make();var response=callServer.xmlhttp.responseText;if(response.substr(0,1)==='['){var newcont;eval('newcont='+response+';');if(grid==''){for(var i=0;icontent->{$attribute} = $value; break; case 'options': - if ($sendContent[$r]->content->type != 'text') { + if ($sendContent[$r]->content->type != "text" && $sendContent[$r]->content->type != "textarea") { $sendContent[$r]->content->{$attribute} = toJSArray($value); } else { $sendContent[$r]->content->{$attribute} = toJSArray((isset($value[$_POST["row"]])? array($value[$_POST["row"]]) : array())); diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index d00e52253..cdaf17738 100755 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -1982,24 +1982,32 @@ class XmlForm_Field_Textarea extends XmlForm_Field * @param string owner * @return string */ - public function renderGrid ($values = null, $owner = null) + public function renderGrid ($values = array(), $owner = null) { $this->gridFieldType = 'textarea'; if ($owner->mode != 'view') { $this->renderMode = $this->modeForGrid; } - $result = array (); + + $result = array(); + $arrayOptions = array(); + $r = 1; foreach ($values as $v) { - $this->executeSQL( $owner, $r ); - if (isset( $this->sqlOption )) { - $firstElement = key( $this->sqlOption ); - if (isset( $firstElement )) { - $v = $firstElement; - } + $this->executeSQL($owner, $r); + + if (isset($this->sqlOption)) { + $firstElement = key($this->sqlOption); } + + if (isset($firstElement)) { + $v = $firstElement; + } + + $arrayOptions[$r] = $v; + $scrollStyle = $this->style . "overflow:scroll;overflow-y:scroll;overflow-x:hidden;overflow:-moz-scrollbars-vertical;"; $html = ''; if ($this->renderMode == 'edit') { @@ -2031,6 +2039,8 @@ class XmlForm_Field_Textarea extends XmlForm_Field $result[] = $html; $r ++; } + + $this->options = $arrayOptions; return $result; } }