Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix radio button 'name' attribute

  • Loading branch information...
commit 8e2aa7478b74ff64a3e735faeee7e62a513c5f95 1 parent 031c700
@choptastic authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/elements/forms/element_radio.erl
View
11 src/elements/forms/element_radio.erl
@@ -1,3 +1,4 @@
+% vim: ts=4 sw=4 et
% Nitrogen Web Framework for Erlang
% Copyright (c) 2008-2010 Rusty Klophaus
% See MIT-LICENSE for licensing information.
@@ -31,7 +32,15 @@ render_element(Record) ->
wf_tags:emit_tag(input, [
{id, Anchor},
{value, Record#radio.value},
- {name, Record#radio.html_name},
+
+ %% the emitted name gives priority to html_name, but if it's
+ %% undefined, then we fall back to the name attribute.
+ %% Note, this might seem a bit hacky to have html_name and name
+ %% that do essentially the same thing, but they have their own
+ %% semantic meanings. 'html_name' is generally reserved for
+ %% RESTful forms, while 'name' will be the more commonly used
+ %% attribute.
+ {name, wf:coalesce([Record#radio.html_name,Record#radio.name])},
{type, radio},
{class, [radio, Record#radio.class]},
{style, Record#radio.style},
Please sign in to comment.
Something went wrong with that request. Please try again.