I want to display the form, read only mode, the fields in the label format.
Is there a Macro sc_dsplay_field_as_label (on | off) or ene another way?
This macro effectively makes the field a label field (taken from macro section of SC manual):
sc_field_readonly({Field}, on/off)
This macro dynamically set a form field attribute to ‘ReadOnly’. Use this macro only to do it at ‘runtime’. Otherwise set this parameter on / off on the form interface. section “Read-Only”.
The on/off parameter its optional, used by an ajax event to define if a field its going to be read-only (On) or read-only (Off).
Ex 1: To set a field as read only even when the form is in “Addition mode”:
if (sc_btn_new)
{
sc_field_readonly({my_field});
}
Ex. 2: To set a field as read only dynamically use:
sc_field_readonly({my_field});
That’s it exactly. Many thanks!
If I want to do this dynamically, meaning I want to disable a field based on a previous selection in a select dropdown, how can I enable or disable that field as read-only depending on the chosen option?
If you have a field called “my_field” and want it made read-only if a certain condition is true, e.g. based on the value of an earlier “dropdown” field’s value:
if ( {dropdown} == 'this' ) {
sc_field_readonly( {my_field} );
}