Skip to content
Snippets Groups Projects
Commit 839dbd36 authored by srosse's avatar srosse
Browse files

OO-1068: fix an issue with the id of radio element

parent 437fa869
No related branches found
No related tags found
No related merge requests found
...@@ -67,12 +67,10 @@ class SingleSelectionComponent extends FormBaseComponentImpl { ...@@ -67,12 +67,10 @@ class SingleSelectionComponent extends FormBaseComponentImpl {
private SingleSelection selectionWrapper; private SingleSelection selectionWrapper;
private int which; private int which;
private String name;
RadioElementComponent(String name, SingleSelection selectionWrapper, int which) { RadioElementComponent(SingleSelection selectionWrapper, int which) {
this.selectionWrapper = selectionWrapper; this.selectionWrapper = selectionWrapper;
this.which = which; this.which = which;
this.name = name;
} }
String getGroupingName(){ String getGroupingName(){
...@@ -88,7 +86,7 @@ class SingleSelectionComponent extends FormBaseComponentImpl { ...@@ -88,7 +86,7 @@ class SingleSelectionComponent extends FormBaseComponentImpl {
} }
String getFormDispatchId() { String getFormDispatchId() {
return name; return selectionWrapper.getFormDispatchId() + "_R_" + which;
} }
public String getValue() { public String getValue() {
......
...@@ -287,8 +287,7 @@ public class SingleSelectionImpl extends FormItemImpl implements SingleSelection ...@@ -287,8 +287,7 @@ public class SingleSelectionImpl extends FormItemImpl implements SingleSelection
} else { } else {
RadioElementComponent[] radios = new RadioElementComponent[keys.length]; RadioElementComponent[] radios = new RadioElementComponent[keys.length];
for (int i = 0; i < keys.length; i++) { for (int i = 0; i < keys.length; i++) {
String radioName = getName() + "_" + keys[i]; radios[i] = new RadioElementComponent(this, i);
radios[i] = new RadioElementComponent(radioName, this, i);
} }
String ssscId = getFormItemId() == null ? null : getFormItemId() + "_RADIO"; String ssscId = getFormItemId() == null ? null : getFormItemId() + "_RADIO";
SingleSelectionComponent ssc = new SingleSelectionComponent(ssscId, this); SingleSelectionComponent ssc = new SingleSelectionComponent(ssscId, this);
......
...@@ -82,11 +82,12 @@ class SingleSelectionRenderer extends DefaultComponentRenderer { ...@@ -82,11 +82,12 @@ class SingleSelectionRenderer extends DefaultComponentRenderer {
String key = ssec.getKey(); String key = ssec.getKey();
String value = ssec.getValue(); String value = ssec.getValue();
boolean selected = ssec.isSelected(); boolean selected = ssec.isSelected();
String formDispatchId = ssec.getFormDispatchId();
// read write view // read write view
sb.append("<label class='radio").append("-inline", inline) sb.append("<label class='radio").append("-inline", inline)
.append("' for='").append(ssec.getFormDispatchId()).append("'>") .append("' for='").append(formDispatchId).append("'>")
.append("<input id='").append(ssec.getFormDispatchId()).append("' ") .append("<input id='").append(formDispatchId).append("' ")
.append("type='radio' ").append(subStrName) .append("type='radio' ").append(subStrName)
.append(" value='").append(key).append("' ") .append(" value='").append(key).append("' ")
.append(" checked='checked' ", selected); .append(" checked='checked' ", selected);
...@@ -102,9 +103,9 @@ class SingleSelectionRenderer extends DefaultComponentRenderer { ...@@ -102,9 +103,9 @@ class SingleSelectionRenderer extends DefaultComponentRenderer {
if(source.isEnabled()){ if(source.isEnabled()){
//add set dirty form only if enabled //add set dirty form only if enabled
sb.append(FormJSHelper.getJSStartWithVarDeclaration(ssec.getFormDispatchId())); sb.append(FormJSHelper.getJSStartWithVarDeclaration(formDispatchId))
sb.append(FormJSHelper.getSetFlexiFormDirtyForCheckbox(ssec.getRootForm(), ssec.getFormDispatchId())); .append(FormJSHelper.getSetFlexiFormDirtyForCheckbox(ssec.getRootForm(), formDispatchId))
sb.append(FormJSHelper.getJSEnd()); .append(FormJSHelper.getJSEnd());
} }
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment