SBM JavaScript Library Guide → JavaScript Examples → Changing Field Properties Based on Field Value Length
To use the following example, verify that the system Description field has been added to your application and is available on your custom form. This example also uses the system Title field, which is automatically added to all applications.
In this example, the Description field is set as required if the Title field contains fewer than 20 characters.
function TitleChanged() { var text = GetFieldValue("TITLE"); if (text.length < 20) { MakeFieldRequired("DESCRIPTION"); } else { MakeFieldOptional("DESCRIPTION"); } } AddChangeCallback("TITLE", TitleChanged);
Copyright © 2007–2018 Serena Software, Inc., a Micro Focus company. All rights reserved.