Is it possible to add/delete or hide/show programmatically a choice in a radio button?

It is often necessary to restrict the radio button options depending on the user. How would this be possible with JavaScript in Plumsail Forms?

Hello @Cumatale,

You can check the name of the current user on the form load and hide options. For instance:

fd.spRendered(function(){
    //get current user name
    var userName = _spPageContextInfo.userDisplayName;

    if(userName == 'Jane Doe') {
        //hide first option
        fd.field('Choice')._data.options.splice(0,1)
    }
}); 

Also, you can get the current user login name, eg jdoe@contoso.onmicrosoft.com, using this code:

_spPageContextInfo.userLoginName