View Form Choice control to micmic new or edit form

Is it possible to set some of the controls like options and checkbox in view form to mimic new or edit form so it shows all the options that are not selected as well? Thank you.

Hello @ShantiBhattarai,

You can replace the Choice field with HTML control, list all elements and conditionally check the values. Please see the sample below.

The code in HTML control:

<input type="checkbox" id="Choice1" value="Choice 1" disabled> Choice1<br>
<input type="checkbox" id="Choice2" value="Choice 2" disabled> Choice1<br>
<input type="checkbox" id="Choice3" value="Choice 3" disabled> Choice1<br>

The script in JavaScript Editor:

fd.spRendered(function() {
	if (fd.field('Choice').value.includes("Choice 1")) {
		document.getElementById("Choice1").checked = true;
	}
	if (fd.field('Choice').value.includes("Choice 2")) {
		document.getElementById("Choice2").checked = true;
	}
	if (fd.field('Choice').value.includes("Choice 3")) {
		document.getElementById("Choice3").checked = true;
	}
});

Thank you this is exactly what i want.

1 Like