<commit_before>% Nitrogen Web Framework for Erlang
% Copyright (c) 2008-2009 <NAME>
% See MIT-LICENSE for licensing information.

-module (element_radio).
-include ("wf.inc").
-compile(export_all).

reflect() -> record_info(fields, radio).

render(ControlID, Record) -> 
    CheckedOrNot = case Record#radio.checked of
		       true -> checked;
		       _ -> not_checked
		   end,
    case Record#radio.postback of
 	undefined -> ok;
	Postback -> wf:wire(ControlID, #event { type=change, postback=Postback })
    end,
    Content = wf:html_encode(Record#radio.text, Record#radio.html_encode),
    [
     %% Checkbox...
     wf_tags:emit_tag(input, [
			      {id, ControlID}, 
			      {name, Record#radio.name},
			      {type, radio},
			      {class, [radio, Record#radio.class]},
			      {style, Record#radio.style},
			      {CheckedOrNot, true}
			     ]),
     
     %% Label for Radio...
     wf_tags:emit_tag(label, Content, [
				       {for, ControlID}
				      ])
    ].<commit_msg>Emit value attribute<commit_after>% Nitrogen Web Framework for Erlang
% Copyright (c) 2008-2009 <NAME>
% See MIT-LICENSE for licensing information.

-module (element_radio).
-include ("wf.inc").
-compile(export_all).

reflect() -> record_info(fields, radio).

render(ControlID, Record) -> 
    CheckedOrNot = case Record#radio.checked of
	true -> checked;
	_ -> not_checked
    end,
    case Record#radio.postback of
	undefined -> ok;
	Postback -> wf:wire(ControlID, #event { type=change, postback=Postback })
    end,
    Content = wf:html_encode(Record#radio.text, Record#radio.html_encode),
    [
	%% Checkbox...
	wf_tags:emit_tag(input, [
		{id, ControlID}, 
		{name, Record#radio.name},
		{value, Record#radio.value},
		{type, radio},
		{class, [radio, Record#radio.class]},
		{style, Record#radio.style},
		{CheckedOrNot, true}
	    ]),

	%% Label for Radio...
	wf_tags:emit_tag(label, Content, [
		{for, ControlID}
	    ])
    ].
{'fraction_non_alphanumeric': 0.14803312629399587, 'fraction_numerical': 0.008281573498964804, 'mean_word_length': 3.0439330543933054, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3088172', 'n_tokens_mistral': 715, 'n_tokens_neox': 635, 'n_words': 142}