Page 1 of 1

Show all radio button choices on display form.

Posted: 11 Nov 2020
by Katy
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)

Re: Show all radio button choices on display form.

Posted: 12 Nov 2020
by Nikita Kurguzov
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);

Re: Show all radio button choices on display form.

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