This patch adds some additional information to the #states example in the Form API Example module that helps make it easier to figure out how to construct the array value for the #states parameter. And where to look to find more information about possible valid values for both the states and conditions.
It also includes a fix in the existing docblock for the class changing #state to #states since #states is the property name. And updates the existing jQuery selector used to :input[name="needs_accommodation"]
which is more generic, and probably a better best-practice to document than input[name="needs_accommodation"]
.
Comment | File | Size | Author |
---|---|---|---|
#5 | 2933259-5-eojthebrave_form_api_example.patch | 3.81 KB | eojthebrave |
| |||
#3 | interdiff.txt | 2.13 KB | Mile23 |
#3 | 2933259_3.patch | 2.32 KB | Mile23 |
| |||
form_api_example-states.patch | 2.12 KB | eojthebrave | |
Comments
Comment #2
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commentedComment #3
Mile23I made some minor edits, in this patch.
Since this patch changes the selector, and since there's no test of whether this works in the first place, we need to add a test that proves that this selector works, and therefore the change isn't breaking anything.
So that's a functional JS test that gets the page, verifies that the field is invisible, checks the checkbox, and then verifies that the field is visible.
Setting to NR to run the patch through the testbot, but really this is NW.
Comment #4
Mile23Comment #5
eojthebraveHere's an updated patch with tests. This contains the patch from #3 + a new file with tests.
Comment #7
Mile23Diggit. Thanks!