Set form fields to required or not based on the value of a checkbox.
If this checkbox is checked, the name and email field will become required. If not, they will be optional. Mandatory attributes: ms-code-req-if-checked (the checkbox that changes the required state), ms-code-req-input (the input - or inputs - that will be required if the checkbox is checked). Optional attributes: ms-code-req-label (Will hide when the input is not set to required) Use the attribute values to group sets together.
If this checkbox is checked, the name and email field will become optional. If not, they will be required. Mandatory attributes: ms-code-req-if-unchecked (the checkbox that changes the required state), ms-code-req-input (the input - or inputs - that will be required if the checkbox is unchecked). Optional attributes: ms-code-req-label (Will hide when the input is not set to required) Use the attribute values to group sets together.
This can be used in combination with the previous 2 examples - but, this attribute added to the checkbox will make it so that when the fields are not required, they are also set to 80% opacity and have pointer events set to none.Mandatory attributes: ms-code-disable-if-not-req (add this to the checkbox in combination with the previous sets of attributes).