I have a tab containing some Boolean flags such as RequestEmail, RequestHomeDirectory etc. Some of the flags, such as RequestEmail, have secondary controls that need to be populated if the primary control has been checked.
For example, if RequestEmail is selected, I need the user to select a location from a drop down list (the location will drive the email suffix assigned to the user by Exchange). If RequestEmail is not checked, the selection in the drop down list can remain blank.
I have the value of the Required flag for the OfficeLocation drop down list toggled based on the value of the RequestEmail control as shown below:
<my:Control my:Name="RequestEmail" my:TypeName="UocCheckBox" my:Caption="{Binding Source=schema, Path=RequestEmail.DisplayName}" my:Description="{Binding Source=schema, Path=RequestEmail.Description}" my:RightsLevel="{Binding Source=rights, Path=RequestEmail}" my:AutoPostback="true"><my:Properties><my:Property my:Name="Text" my:Value="Enable if a mailbox is required" /><my:Property my:Name="Checked" my:Value="{Binding Source=object, Path=RequestEmail, Mode=TwoWay}" /></my:Properties></my:Control><my:Control my:Name="OfficeLocation" my:TypeName="UocDropDownList" my:Caption="{Binding Source=schema, Path=OfficeLocation.DisplayName}" my:Description="{Binding Source=schema, Path=OfficeLocation.Description}" my:RightsLevel="{Binding Source=rights, Path=OfficeLocation}"><my:Options><my:Option my:Value="Aberdeen" my:Caption="Aberdeen" my:Hint="Aberdeen" /><my:Option my:Value="Belfast" my:Caption="Belfast" my:Hint="Belfast" /><my:Option my:Value="Cardiff" my:Caption="Cardiff" my:Hint="Cardiff" /><my:Option my:Value="Derby" my:Caption="Derby" my:Hint="Derby" /><my:Option my:Value="Edinburgh" my:Caption="Edinburgh" my:Hint="Edinburgh" /><my:Option my:Value="Leeds" my:Caption="Leeds" my:Hint="Leeds" /><my:Option my:Value="Oxford" my:Caption="Oxford" my:Hint="Oxford" /></my:Options><my:Properties><my:Property my:Name="Required" my:Value="{Binding Source=object, Path=RequestEmail, Mode=TwoWay}" /><my:Property my:Name="ItemSource" my:Value="Custom" /><my:Property my:Name="ValuePath" my:Value="Value" /><my:Property my:Name="CaptionPath" my:Value="Caption" /><my:Property my:Name="HintPath" my:Value="Hint" /><my:Property my:Name="SelectedValue" my:Value="{Binding Source=object, Path=OfficeLocation, Mode=TwoWay}" /></my:Properties></my:Control>
A previous process ensures that the initial value of RequestEmail is true, while the initial value of OfficeLocation will not have been assigned any value.
If I submit the page when nothing has been selected in the drop down list, the message 'The required field cannot be empty' is displayed, which is exactly what I want. However, if I then clear the RequestEmail flag, which also makes the red asterisk at the side of the drop down list (indicating that input is required) disappear and submit the page, I am still prompted by the message 'The required field cannot be empty'. It seems that once the page has been submitted when the drop down list was required, this setting is remembered and isn't updated when I clear RequestEmail, even though the value of the Required flag seems to be toggled correctly, as evidenced by the disappearance of the red asterisk on the drop down list indicating input is no longer mandatory.
Is there a way to get the RCDC to behave in the way that I need, or am I battling in vain against a 'feature'?!