diff --git a/web/CXM_form.anubis b/web/CXM_form.anubis index b3e33ba..eb89a38 100644 --- a/web/CXM_form.anubis +++ b/web/CXM_form.anubis @@ -411,6 +411,14 @@ define (List((List(CoreAttrs), WebArgValue, String)), List(HTML_Partial_Content) ) = construct_selector_hide_show(div_id, items, [], [], 0). public define HTML_In_Form + format_div_CXM_Form_Field + ( + CXM_Form_Field field, + List(Web_arg) lwa, + String _class + ). + +public define HTML_In_Form format_CXM_Form_Field ( CXM_Form_Field ff, @@ -500,7 +508,7 @@ public define HTML_In_Form with div_id = generate_random_string(15), sequence([ check_box([data("show_id", div_id), class("in"), class("cxm_checkbox_hide_show"), event(onclick, "checked_hide_show_element('"+div_id+"', this);")], _label, html_Id("checkbox_"+div_id), wan, val, get_Bool(lwa, wan.name, checked)), - div([id(div_id), style("display:"+if checked then "block" else "none")], sequence(map((CXM_Form_Field ff2) |-> div([class("form_field")], format_CXM_Form_Field(ff2, lwa)),fields))) + div([id(div_id), style("display:"+if checked then "block" else "none")], sequence(map((CXM_Form_Field ff2) |-> format_div_CXM_Form_Field(ff2, lwa, "form_field"),fields))) ]), radio_button(options, _label, id, wan, val, checked, mand) then @@ -510,7 +518,7 @@ public define HTML_In_Form with div_id = generate_random_string(15), sequence([ radio_button([data("show_id", div_id), class("in"), class("cxm_radio_hide_show"), event(onclick, "radio_hide_show_group('"+wan.name+"', this);")], _label, html_Id("radio_button_hide_show_"+div_id), wan, val, get_Bool(lwa, wan.name, checked)), - div([id(div_id), style("display:"+if checked then "block" else "none")], sequence(map((CXM_Form_Field ff2) |-> div([class("form_field")], format_CXM_Form_Field(ff2, lwa)),fields))) + div([id(div_id), style("display:"+if checked then "block" else "none")], sequence(map((CXM_Form_Field ff2) |-> format_div_CXM_Form_Field(ff2, lwa, "form_field"),fields))) ]), radio_buttonr(options, _label, id, wan, val, checked, mand) then @@ -568,7 +576,7 @@ public define HTML_In_Form sequence([ literal("
") ]), @@ -593,12 +601,34 @@ public define HTML_In_Form }. public define HTML_In_Form + format_div_CXM_Form_Field + ( + CXM_Form_Field field, + List(Web_arg) lwa, + String _class + )= + if field is empty then + empty + else if field is no_field then + empty + else if field is hidden(id, name, init) then + format_CXM_Form_Field(field, lwa) + else if field is br then + format_CXM_Form_Field(field, lwa) + else + div([class(_class)], format_CXM_Form_Field(field, lwa)) +. + +public define HTML_In_Form format_CXM_Form_Field ( List(CXM_Form_Field) fields, List(Web_arg) lwa )= - sequence( map((CXM_Form_Field ff) |-> div([class("form_field aligned")], format_CXM_Form_Field(ff, lwa)), fields) ). + sequence( map((CXM_Form_Field ff) + |-> + format_div_CXM_Form_Field(ff, lwa, "form_field aligned"), fields)) +. public define HTML_In_Form fieldset @@ -606,7 +636,17 @@ public define HTML_In_Form List(Web_arg) lwa, List(CXM_Form_Field) fields, )= - sequence( map((CXM_Form_Field ff) |-> div([class("form_field aligned")], format_CXM_Form_Field(ff, lwa)), fields) ). + sequence( map((CXM_Form_Field ff) |-> + if ff is empty then + empty + else if ff is no_field then + empty + else if ff is hidden(id, name, init) then + format_CXM_Form_Field(ff, lwa) + else if ff is br then + format_CXM_Form_Field(ff, lwa) + else + div([class("form_field aligned")], format_CXM_Form_Field(ff, lwa)), fields) ). public define HTML_In_Form fieldset @@ -614,7 +654,17 @@ public define HTML_In_Form List(Web_arg) lwa, CXM_Form_Field field, )= - div([class("form_field aligned")], format_CXM_Form_Field(field, lwa)). + if field is empty then + empty + else if field is no_field then + empty + else if field is hidden(id, name, init) then + format_CXM_Form_Field(field, lwa) + else if field is br then + format_CXM_Form_Field(field, lwa) + else + div([class("form_field aligned")], format_CXM_Form_Field(field, lwa)) +. public define HTML_In_Form @@ -622,7 +672,17 @@ public define HTML_In_Form ( List(CXM_Form_Field) fields )= - sequence( map((CXM_Form_Field ff) |-> div([class("form_field aligned")], format_CXM_Form_Field(ff, [])), fields) ). + sequence( map((CXM_Form_Field ff) |-> + if ff is empty then + empty + else if ff is no_field then + empty + else if ff is hidden(id, name, init) then + format_CXM_Form_Field(ff, []) + else if ff is br then + format_CXM_Form_Field(ff, []) + else + div([class("form_field aligned")], format_CXM_Form_Field(ff, [])), fields) ). public define HTML_Off_Form -- libgit2 0.21.4