Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
63764a7d
Commit
63764a7d
authored
May 12, 2018
by
ChaosKid42
Committed by
JC Brand
May 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix selected values in list-multi form fields (#1101)
parent
a33b451b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
src/utils/core.js
src/utils/core.js
+16
-0
src/utils/form.js
src/utils/form.js
+4
-2
No files found.
src/utils/core.js
View file @
63764a7d
...
@@ -814,5 +814,21 @@
...
@@ -814,5 +814,21 @@
const
replacement
=
'
geo:$1,$2
'
;
const
replacement
=
'
geo:$1,$2
'
;
return
text
.
replace
(
_converse
.
geouri_regex
,
replacement
);
return
text
.
replace
(
_converse
.
geouri_regex
,
replacement
);
};
};
u
.
getSelectValues
=
function
(
select
)
{
var
result
=
[];
var
options
=
select
&&
select
.
options
;
var
opt
;
for
(
var
i
=
0
,
iLen
=
options
.
length
;
i
<
iLen
;
i
++
)
{
opt
=
options
[
i
];
if
(
opt
.
selected
)
{
result
.
push
(
opt
.
value
||
opt
.
text
);
}
}
return
result
;
};
return
u
;
return
u
;
}));
}));
src/utils/form.js
View file @
63764a7d
...
@@ -58,8 +58,10 @@
...
@@ -58,8 +58,10 @@
let
value
;
let
value
;
if
(
field
.
getAttribute
(
'
type
'
)
===
'
checkbox
'
)
{
if
(
field
.
getAttribute
(
'
type
'
)
===
'
checkbox
'
)
{
value
=
field
.
checked
&&
1
||
0
;
value
=
field
.
checked
&&
1
||
0
;
}
else
if
(
field
.
tagName
==
"
textarea
"
)
{
}
else
if
(
field
.
tagName
==
"
TEXTAREA
"
)
{
value
=
_
.
filter
(
field
.
value
.
split
(
'
\n
'
),
_
.
trim
);
value
=
_
.
filter
(
field
.
value
.
split
(
'
\n
'
),
_
.
trim
);
}
else
if
(
field
.
tagName
==
"
SELECT
"
)
{
value
=
u
.
getSelectValues
(
field
);
}
else
{
}
else
{
value
=
field
.
value
;
value
=
field
.
value
;
}
}
...
@@ -96,7 +98,7 @@
...
@@ -96,7 +98,7 @@
return
tpl_select_option
({
return
tpl_select_option
({
'
value
'
:
value
,
'
value
'
:
value
,
'
label
'
:
option
.
getAttribute
(
'
label
'
),
'
label
'
:
option
.
getAttribute
(
'
label
'
),
'
selected
'
:
_
.
startsWith
(
values
,
value
),
'
selected
'
:
values
.
includes
(
value
),
'
required
'
:
!
_
.
isNil
(
field
.
querySelector
(
'
required
'
))
'
required
'
:
!
_
.
isNil
(
field
.
querySelector
(
'
required
'
))
})
})
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment