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
61c69bda
...
61c69bda24e9cfc4ac39ee9c72f1e6cf554a3de0
authored
2011-11-29 23:47:56 -0800
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge pull request #20 from cbenz/cbenz
Handle multiple values for checkboxes.
2 parents
b025ea98
af1e3dc0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletions
casper.js
casper.js
View file @
61c69bd
...
...
@@ -1187,7 +1187,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