Permalink
Browse files

fix error when 'Default' parameter in wpart_multilist:build_html_tag/…

…2 is integer
  • Loading branch information...
1 parent f6e58b4 commit b9f4e3fee74e20f3beb09ba99c50d7cc941896d2 Piotr Dorobisz committed Sep 29, 2011
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/wparts-1.4.1/src/wpart_multilist.erl
@@ -48,8 +48,14 @@ build_html_tag(Id, Params, Default) ->
{"preselected", Selected} |
proplists:get_value(html_attrs, Params, [])]),
Attrs = [{"name", Id}, {"id", Id} | proplists:delete("name", Attrs0)],
-
- get_html_tag(Attrs, Default).
+
+ D = case Default of
+ Integer when is_integer(Integer) ->
+ [integer_to_list(Integer)];
+ _ ->
+ Default
+ end,
+ get_html_tag(Attrs, D).
build_html_tag(Name, Prefix, Params, Default) ->
N = wpart_derived:generate_long_name(Prefix, Name),
@@ -123,7 +129,7 @@ get_html_tag(Attrs0, DefaultList) ->
selected(Value, DefaultList, Preselected) ->
lists:member(Value, DefaultList) orelse
- lists:member(Value, Preselected).
+ lists:member(Value, Preselected).
load_tpl() ->
wpart_gen:load_tpl(multilist_select,

0 comments on commit b9f4e3f

Please sign in to comment.