Show all radio button choices on display form.

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

11 Nov 2020

Hello there,
When the user creates a new entry or edit form, they pick a radio button. However, when they view using the display form, only the choice that they selected appears (which is logical and expected). I want to make it so that ALL of the possible choices appear. Is there any possible way of doing this?
(I think I saw a post in the forum about it, but I can't find it now. I would appreciate if you refer me to it)

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

12 Nov 2020

Dear Katy,
Here you go, you only need to change the Internal Field name from Radio to your field name, and replace options in the array with your options:

Code: Select all

var value = fd.field('Radio').value();
var options = ['Enter Choice #1','Enter Choice #2','Enter Choice #3']
var control = '<span dir="none"><table cellpadding="0" cellspacing="1"><tbody>'
options.forEach(function(option){
  if(option == value){
      control += '<tr><td><span class="ms-RadioText" title="' + option + '"><input type="radio" checked="checked" disabled="disabled"><label>' + option + '</label></span></td></tr>'
  }
  else{
      control += '<tr><td><span class="ms-RadioText" title="' + option + '"><input type="radio" disabled="disabled"><label>' + option + '</label></span></td></tr>'
  }
});
control += '</tbody></table></span></div>'
fd.field('Radio')._control._el().html(control);
Cheers

Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

16 Nov 2020

Thank you, Nikita! That works!
The only thing is I need to change the script every time the options are changed :-))

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests