[FormControlEventHandler(formControlStr(JmgParameters, ViolationPenalties_PenaltyCode), FormControlEventType::Modified)]
public static void ViolationPenalties_PenaltyCode_OnModified(FormControl sender, FormControlEventArgs e)
{
PenaltyType penaltyType = PenaltyTypes::find(sender.valueStr()).PenaltyType;
FormRun formRun = sender.formRun();
FormControl cntrol = formRun.design().controlName("ViolationPenalties_Penalty");
if (penaltyType == PenaltyType::Warning)
{
if (cntrol)
{
cntrol.enabled(true);
}
}
else
{
if (cntrol)
{
cntrol.enabled(false);
}
}
}
Hello @Layan Jwei,
I have already sent an email to the community support team three days ago, but no one has responded. So, if possible, please mark your answer as Verified.
[FormDataSourceEventHandler(formDataSourceStr(JmgParameters, ViolationPenalties), FormDataSourceEventType::Activated)]
public static void ViolationPenalties_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
ViolationPenalties currentRecord = sender.cursor() as ViolationPenalties;
if (currentRecord)
{
if (PenaltyTypes::findByRecid(currentRecord.PenaltyTypesReferenceGroup).PenaltyType == PenaltyType::Warning)
{
sender.object(fieldNum(ViolationPenalties, Penalty)).allowEdit(true);
}
else
{
sender.object(fieldNum(ViolationPenalties, Penalty)).allowEdit(false);
}
}
}
Thanks,
Layan Jweihan
Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future.
André Arnaud de Cal...
292,162
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156