Skip to content

Commit 6adf1e7

Browse files
committed
unique identifiers in form
1 parent 552305c commit 6adf1e7

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

Ajax/semantic/widgets/base/InstanceViewer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use Ajax\service\JString;
44

55
class InstanceViewer {
6+
protected $widgetIdentifier;
67
protected $instance;
78
protected $reflect;
89
protected $properties;
@@ -14,7 +15,8 @@ class InstanceViewer {
1415

1516
public static $index=0;
1617

17-
public function __construct($instance=NULL,$captions=NULL){
18+
public function __construct($identifier,$instance=NULL,$captions=NULL){
19+
$this->widgetIdentifier=$identifier;
1820
$this->values=[];
1921
$this->afterCompile=[];
2022
if(isset($instance))

Ajax/semantic/widgets/dataelement/DataElement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class DataElement extends Widget {
2020

2121
public function __construct($identifier, $modelInstance=NULL) {
2222
parent::__construct($identifier, null,$modelInstance);
23-
$this->_instanceViewer=new InstanceViewer();
23+
$this->_instanceViewer=new InstanceViewer($identifier);
2424
$this->content=["table"=>new HtmlTable($identifier, 0,2)];
2525
$this->content["table"]->setDefinition();
2626
$this->_toolbarPosition=PositionInTable::BEFORETABLE;

Ajax/semantic/widgets/dataform/DataForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class DataForm extends Widget {
2121

2222
public function __construct($identifier, $modelInstance=NULL) {
2323
parent::__construct($identifier, null,$modelInstance);
24-
$this->_instanceViewer=new FormInstanceViewer();
24+
$this->_instanceViewer=new FormInstanceViewer($identifier);
2525
$this->content=["form"=>new HtmlForm($identifier)];
2626
$this->_toolbarPosition=PositionInTable::BEFORETABLE;
2727
}

Ajax/semantic/widgets/dataform/FormInstanceViewer.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
class FormInstanceViewer extends InstanceViewer {
1010
protected $separators;
1111

12-
public function __construct($instance=NULL, $captions=NULL) {
13-
parent::__construct($instance=NULL, $captions=NULL);
12+
public function __construct($identifier,$instance=NULL, $captions=NULL) {
13+
parent::__construct($identifier,$instance=NULL, $captions=NULL);
1414
$this->separators=[-1];
1515
}
1616

@@ -26,7 +26,8 @@ protected function _beforeAddProperty($index,&$field){
2626

2727
protected function _getDefaultValue($name,$value,$index){
2828
$caption=$this->getCaption($index);
29-
$input=new HtmlFormInput($name,$caption,"text",$value);
29+
$input=new HtmlFormInput($this->widgetIdentifier."-".$name,$caption,"text",$value);
30+
$input->setName($name);
3031
return $input;
3132
}
3233

Ajax/semantic/widgets/datatable/DataTable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function run(JsUtils $js){
4141

4242
public function __construct($identifier,$model,$modelInstance=NULL) {
4343
parent::__construct($identifier, $model,$modelInstance);
44-
$this->_instanceViewer=new InstanceViewer();
44+
$this->_instanceViewer=new InstanceViewer($identifier);
4545
$this->content=["table"=>new HtmlTable($identifier, 0,0)];
4646
$this->_toolbarPosition=PositionInTable::BEFORETABLE;
4747
}

0 commit comments

Comments
 (0)