Commit 31541417083cacdda36f86367f5090e43c135bf4
1 parent
54d3af2b
add radio_button hide show. This allow to show or hide some fields when the radi…
…o button is selected or not
Showing
2 changed files
with
18 additions
and
3 deletions
Show diff stats
web/CXM_form.anubis
| ... | ... | @@ -142,6 +142,14 @@ public type CXM_Form_Field: |
| 142 | 142 | WebArgValue web_arg_value, |
| 143 | 143 | Bool checked, |
| 144 | 144 | Mandatory mandatory), |
| 145 | + //radio_button_hide_show | |
| 146 | + radio_button_hide_show( | |
| 147 | + List(InputAttrs) options, | |
| 148 | + String label, | |
| 149 | + WebArgName web_arg_name, | |
| 150 | + WebArgValue web_arg_value, | |
| 151 | + Bool checked, | |
| 152 | + List(CXM_Form_Field) fields), | |
| 145 | 153 | // the same one, but with the tag on the right of the radio_button |
| 146 | 154 | radio_buttonr (List(InputAttrs) options, |
| 147 | 155 | String label, |
| ... | ... | @@ -408,12 +416,19 @@ public define HTML_In_Form |
| 408 | 416 | checkbox_hide_show(options, label, wan, val, checked, fields) then |
| 409 | 417 | with div_id = generate_random_string(15), |
| 410 | 418 | sequence([ |
| 411 | - check_box([event(onclick, "checkbox_hide_show_element('"+div_id+"', this);")], label, htmlId(""), wan, val, get_Bool(lwa, wan.name, checked)), | |
| 419 | + check_box([class("in"), event(onclick, "checked_hide_show_element('"+div_id+"', this);")], label, htmlId(""), wan, val, get_Bool(lwa, wan.name, checked)), | |
| 412 | 420 | div([id(div_id), style("display:"+if checked then "block" else "none")], sequence(map((CXM_Form_Field ff2) |-> div([class("form_field")], cxm_format_form_field(ff2, lwa)),fields))) |
| 413 | 421 | ]), |
| 414 | 422 | |
| 415 | 423 | radio_button(options, label, id, wan, val, checked, mand) then |
| 416 | - radio_button([class("in") . options], label + star(mand), id, wan, val, get_Bool(lwa, wan.name, checked)), | |
| 424 | + radio_button([class("in"), event(onclick, "radio_hide_show_group('"+wan.name+"', this);") . options], label + star(mand), id, wan, val, get_Bool(lwa, wan.name, checked)), | |
| 425 | + | |
| 426 | + radio_button_hide_show(options, label, wan, val, checked, fields) then | |
| 427 | + with div_id = generate_random_string(15), | |
| 428 | + sequence([ | |
| 429 | + radio_button([data("show_id", div_id), class("in"), event(onclick, "radio_hide_show_group('"+wan.name+"', this);")], label, htmlId(""), wan, val, get_Bool(lwa, wan.name, checked)), | |
| 430 | + div([id(div_id), style("display:"+if checked then "block" else "none")], sequence(map((CXM_Form_Field ff2) |-> div([class("form_field")], cxm_format_form_field(ff2, lwa)),fields))) | |
| 431 | + ]), | |
| 417 | 432 | |
| 418 | 433 | radio_buttonr(options, label, id, wan, val, checked, mand) then |
| 419 | 434 | radio_button_r([class("in") . options], label + star(mand), id, wan, val, get_Bool(lwa, wan.name, checked)), | ... | ... |
web/widgets/button.anubis
| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | read calexium_lib/web/CXM_making_a_web_site.anubis |
| 10 | -read calexium_lib/web/CXM_jquery.anubis | |
| 10 | +transmit calexium_lib/web/CXM_jquery.anubis | |
| 11 | 11 | read calexium_lib/web/CXM_json.anubis |
| 12 | 12 | read calexium_lib/web/js_tools.anubis |
| 13 | 13 | transmit calexium_lib/web/widgets/icons_set.anubis | ... | ... |