User tests: Successful: Unsuccessful:
Pull Request for a new Feature
Implementation for an new attribute requireon
to the form field spec to that accepts conditional statements identical to that of the showon
attribute. However the effect is to toggle the required
attribute on form fields and show/hode the little star next to the label that indicates that the field is required.
Some argue that having to toggle the requiredness of a field is a design flaw in the form, however I believe that it is not. For example a form to specify OAuth2 settings could have a dropdown to indicate the grant type. Depending on the grant type chosen, the form can change quite drastically. Some fields are not relevant for certain grant types and can be hidden, others are no longer required. The problem with only showon
is that you can hide these fields, but a hidden field still remains required and form validation will not pass succesfully.
Create a form with a listfield with two options and a field that has the new attribute, for example this content:
<?xml version="1.0" encoding="utf-8"?>
<field
name="foo"
type="list"
>
<option value="1">MANDATORY</option>
<option value="0">OPTIONAL</option>
</field>
<field
name="bar"
type="text"
requireon="foo:1"
/>
</form>
Open the form and change the selection of the foo
field and see the bar
field become mandory or optional.
Any form field that uses the requireon
attribute remain required or optiona depending on value of the required
attribute.
Any fields that are conditionally required will be required when the condition evaluates to true. The logic works the same as for the showon
attribute.
(https://docs.joomla.org/Form_field#Modal_form_field_types) can probably be documented in one fell swoop with the ShowOn property explanations.
Status | New | ⇒ | Pending |
Category | ⇒ | Repository NPM Change JavaScript Layout Libraries |
Labels |
Added:
NPM Resource Changed
?
|
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-05-15 09:21:00 |
Closed_By | ⇒ | stephan-ansems |
Sorry guys I'm causin chaos here.