I have radio button CountType with 5 selections. If the user ID=‘x’, I want CountType button 4 disabled. Thought I could do this with sc_field_display but nothing I do to reference button 4 seems to affect it.
is the Radio button loaded “Manual” or Automatic via a SQL statement
If done done via SQL statement then you can use the where option in the sql statement to exclude
It is a manual lookup…option1, option2, etc. I want to disable option2 for certain users who should not access that function. Is there no way to sc_field_disabled(radiobutton[option2]) instead of the entire radiobutton field?
Not as far as I know. Perhaps somebody else has a better idea.
I suggest: Create a table with the options and the users that can access it, or even better if you are using the security you can assign a role to the person and then do a lookup from the table by role.
If at a later stage some body else is added then you do not need to edit the code and regenerate but only add the person to the role.
it is a very good question. somehow software world totally neglects the fact that options can be disable but still have to be viewable. if you just remove some options, you will get empty controls even if they have a value. basically we have to remove options when we assign new values (we do not wanna assign inactive options for new records) and we need to have all old options in order to see them. somehow this contradiction escaped all programming languages/controls.
if a user opens a form with an option for which he has no authorisation , what do you do?
authorisation can be - view , edit. if the user can view the value, but not edit, i would say, you make the control disabled, but user still can see the value. if the user must not view the option, you can hide the option control.
you need to add additional options/fields authorisation table/configuration as SC does not support it at the fields/records level.
The problem is on radio buttons that, afaik, disabling the control takes the entire radio button set instead of one single option.
Well, you van try this, it’s not the most charming sollution.
Use Ajax. On blur. Followed by a script. When user changes when not wanten, change the radio, and display a message.
Other sollution.
Use two new radio fields, with the disered options. Show the field depending on user of status
Clever idea. I’ll play with both options. May not be charming nor elegant, but useful! Thanks.
exactly , this was my point, options should allow disabled options, only for viewing but not allow to select them. i guess if you pull options automatically you can add disabled ones at the end , even add a text (like an option) but just with a title text. and use logicx of ajax like @mollyshark mollyshark said
If you still need it you can use jQuery (onScriptInit)
if ($condition == true) {
?>
<script>
$(document).ready(function() {
$("#id-opt-counttype-3").parent().hide();
});
</script>
<?php
}
Thanks. It’s an easier solution than the one I finally came up with!