Change from Required to Not Required and visa-versa

How would you programatically change a field from
Required to Not Required
and
Not Required to Required

[QUOTE=Larryh1115;35813]How would you programatically change a field from
Required to Not Required
and
Not Required to Required[/QUOTE]

Manually.

OnValidate you can see the conditions for a field to be required, and if true, then throw an sc_error

Giu -
How would identify that the hidden field is what is throwing the error, as per your comment “OnValidate you can see the conditions for a field to be required, and if true, then throw an sc_error”

since I am hiding various fields under certain conditions, which are Required when visible, how would I disable the Required on the “hidden fields”

I wrote from mobile. What I mean, is, you can do your checks onValidate event, and if there are some “thing” thath must avoid to validate, then throw an error.

For example. {value} is required when {manualValue} is true, then, you can

if ({manualValue}){
   if (empty({value})) {
        sc_error_message("Value can't be empty");
   }
}

I hope I explained better.

@Gui, this is not exactly what he meens.
if you set a field as required and it is hidden, the insert/update will not work when it is empty !
@Larry two possibilities:

  1. When the field is hidden, give the field a value ( 0 ? )
    or
  2. set it as not required, and when it is visible then do Gui’s suggestion !

Thanks Gerd, wow didn’t even think of that.