<commit_before>-module(action_control).
-author('<NAME>').
-include_lib("n2o/include/wf.hrl").
-compile(export_all).

render_action(#control{ 
    postback=Postback, actions=Actions, source=Source,
    anchor=Anchor, trigger=Trigger, target=Target, validation_group=ValidationGroup,
    type=Type, keycode=KeyCode, shift_key=ShiftKey, delay=Delay, delegate=Delegate,
    extra_param=ExtraParam}) ->

    Data = "[" ++ string:join([ "Bert.tuple(Bert.atom('"++atom_to_list(Src)++
                     "'), utf8.toByteArray($('#"++atom_to_list(Src)++"').val()))" || Src <- Source ],",") ++ "]",

    ValidationGroup1 = wf:coalesce([ValidationGroup, Trigger]),
    PostbackScript = wf_event:generate_postback_script(Postback, Anchor, ValidationGroup1, Delegate, control_event, Data),
    WireAction = #wire { trigger=Trigger, target=Target, actions=Actions },

    [
        wf:f("$('#~s').bind('~s',function anonymous(event) { ", [ValidationGroup1,Type]), PostbackScript, "});"
    ].<commit_msg>remove postback field<commit_after>-module(action_control).
-author('<NAME>').
-include_lib("n2o/include/wf.hrl").
-compile(export_all).

render_action(#control{ 
    actions=Actions, source=Source,
    anchor=Anchor, trigger=Trigger, target=Target, validation_group=ValidationGroup,
    type=Type, keycode=KeyCode, shift_key=ShiftKey, delay=Delay, delegate=Delegate,
    extra_param=ExtraParam}) ->

    Data = "[" ++ string:join([ "Bert.tuple(Bert.atom('"++atom_to_list(Src)++
                     "'), utf8.toByteArray($('#"++atom_to_list(Src)++"').val()))" || Src <- Source ],",") ++ "]",

    ValidationGroup1 = wf:coalesce([ValidationGroup, Trigger]),
    PostbackScript = wf_event:generate_postback_script(Postback, Anchor, ValidationGroup1, Delegate, control_event, Data),
    WireAction = #wire { trigger=Trigger, target=Target, actions=Actions },

    [
        wf:f("$('#~s').bind('~s',function anonymous(event) { ", [ValidationGroup1,Type]), PostbackScript, "});"
    ].
{'fraction_non_alphanumeric': 0.18835443037974683, 'fraction_numerical': 0.005063291139240506, 'mean_word_length': 5.333333333333333, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5084632', 'n_tokens_mistral': 660, 'n_tokens_neox': 633, 'n_words': 87}