Retrieve checkbox values saved with ipOpts
Retrieve checkbox values saved with ipOpts
Good morning, I am creating a survey and use:
if (drt_tipo == "input"){
domEditor.clear("isorapptestdom.drt_ris1");
domEditor.add( {
label: "Risposta",
name: "isorapptestdom.drt_ris1"
} );
}
if (drt_tipo == "radio"){
domEditor.clear("isorapptestdom.drt_ris1");
domEditor.add( {
label: "Scelte",
name: "isorapptestdom.drt_ris1",
type: "radio",
options: ["A", "B", "C"]
} );
}
if (drt_tipo == "checkbox"){
domEditor.clear("isorapptestdom.drt_ris1");
domEditor.add( {
label: "Scelte",
name: "isorapptestdom.drt_ris1",
type: "checkbox",
separator: "|",
unselectedValue: "A",
ipOpts: [ "A", "B", "C" ]
} );
}
to create the questions in the various formats and always using the same text field for the answers.
The "checkbox" field creates the list of answers separated by "|".
I would like to understand how to do in edit mode to retrieve selected answers and display them correctly in editor mask.
Is the last problem I have left to finish the project...
Thanks for the help...
This question has an accepted answers - jump to answer
Answers
Hi,
I don't quite understand what you are looking for I'm afraid. On edit, the
isorapptestdom.drt_ris1
property will contain something likeA|C
does it not? So the A and C checkboxes should be checked.Allan
Unfortunately, in edit no value is selected...
In the initial example, I simplified things a bit.
I actually populate the checkbox based on the value of another variable:
Could this be creating the problem?
Basically I do a check to see which checkbox boxes are not empty.
Surely there is a more elegant way to do this right?...
If you are able to give me a link to a page showing this issue, that would really help. For example, I'm not sure at what point this code is being executed? Also what is dom1, dom2 and dom3? Is it possible the data is numeric and those are strings?
Allan
I checked. The problem occurs if I use field.update.
It also occurs in this simplified example:
I used "if" conditions:
to exclude empty queries since I use 10 table fields for descriptions that I enter in the variables dom1, dom2, etc...
Is there any chance of a link to the page please? I'm still not clear when you are calling this code - is it in an
initEdit
event for example? If so, usingclear()
and thenadd()
will not retain the current value.I think I'd need to see this happening to be able to diagnose and help resolve this.
Regards,
Allan