diff options
| author | Carl Meyer <carl@oddbird.net> | 2013-08-30 20:05:48 -0600 |
|---|---|---|
| committer | Carl Meyer <carl@oddbird.net> | 2013-08-30 20:05:48 -0600 |
| commit | d009e5baabc502abe79730b73279e349a4539135 (patch) | |
| tree | 88aed531d95925f936b65463c7e2695ecd3f9e74 /docs | |
| parent | dcfae9d18833a04f9b7d742fb7d7c6f26eee2923 (diff) | |
| download | webtest-d009e5baabc502abe79730b73279e349a4539135.tar.gz | |
Allow assigning a list to a set of same-named checkboxes.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/form.html | 3 | ||||
| -rw-r--r-- | docs/forms.txt | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/docs/form.html b/docs/form.html index 76ce700..95f6d68 100644 --- a/docs/form.html +++ b/docs/form.html @@ -16,6 +16,9 @@ <input type="radio" name="radio" value="Radio 2" checked="checked"/> <input type="checkbox" name="checkbox" value="checkbox 1" /> <input type="checkbox" name="checkbox2" /> + <input type="checkbox" name="checkboxes" value="a"> + <input type="checkbox" name="checkboxes" value="b" checked="checked"> + <input type="checkbox" name="checkboxes" value="c"> <input type="hidden" name="hidden" value="1" /> <input type="file" name="file" value="" /> <input type="submit" name="submit" value="Submit" /> diff --git a/docs/forms.txt b/docs/forms.txt index 6215376..02569f6 100644 --- a/docs/forms.txt +++ b/docs/forms.txt @@ -142,6 +142,17 @@ If the checkbox has no value then it will be 'on' if you checked it:: >>> print(form['checkbox2'].value) on +If there are multiple checkboxes of the same name, you can assign a list to +that name to check all the checkboxes whose value is present in the list:: + + >>> form['checkboxes'] = ['a', 'c'] + >>> print(form.get('checkboxes', index=0).value) + a + >>> print(form.get('checkboxes', index=1).value) + None + >>> print(form.get('checkboxes', index=2).value) + c + Radio ***** |
