1
votes

I have a requirement where based on the dropdown values, it should default a checkbox or field to a certain value.

So let's say the values for the dropdown are: 1, 2, and 3. If I select 1, a checkbox should be checked. If 2 or 3 is selected, a field should have the default value of "983.3".

The question I'm asking is: How do I clear the checkbox/all form fields upon selection of another dropdown value (2 or 3) after selecting 1? This is so only the conditional default values for 1 or 2/3 will appear on the form based upon selection.

1

1 Answers

1
votes

I will assume that all your fields are bound to a database table.

Then add the modifiedField method on the table:

public void modifiedField(fieldId _fieldId)
{
    super(_fieldId);
    switch (_fieldId)
    {
        case fieldNum(YourTable,YourDropdown):
            switch (this.YourDropdown)
            {
                case 1:
                    this.YourCheckBox = NoYes::Yes;
                    this.YourField = 0;
                    break;
                case 2, 3:
                    this.YourCheckBox = NoYes::No;
                    this.YourField = 983.3;
                    break;
            }
            break;
    }
}

The update of form fields happens automatically.