Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
af1e3dc0
...
af1e3dc054b8e42fce96ebe3d9cc5a94e093998e
authored
2011-11-29 22:46:33 +0100
by
Christophe Benz
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Handle multiple values for checkboxes.
1 parent
4dd4b736
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletions
casper.js
casper.js
View file @
af1e3dc
...
...
@@ -1186,7 +1186,21 @@
field
.
value
=
value
;
break
;
case
"checkbox"
:
field
.
setAttribute
(
'checked'
,
value
?
"checked"
:
""
);
if
(
fields
)
{
var
values
=
value
;
if
(
!
Array
.
isArray
(
values
))
{
values
=
[
values
];
}
Array
.
prototype
.
forEach
.
call
(
fields
,
function
(
e
)
{
if
(
values
.
indexOf
(
e
.
value
)
!==
-
1
)
{
e
.
setAttribute
(
'checked'
,
'checked'
);
}
else
{
e
.
removeAttribute
(
'checked'
);
}
});
}
else
{
field
.
setAttribute
(
'checked'
,
value
?
"checked"
:
""
);
}
break
;
case
"file"
:
throw
{
...
...
Please
register
or
sign in
to post a comment