Commit 3306145430afb6abfdae08e324b4002833eacd7e
1 parent
40b75e15
format_div_CXM_Form_Field
Showing
1 changed file
with
67 additions
and
7 deletions
Show diff stats
web/CXM_form.anubis
| @@ -411,6 +411,14 @@ define (List((List(CoreAttrs), WebArgValue, String)), List(HTML_Partial_Content) | @@ -411,6 +411,14 @@ define (List((List(CoreAttrs), WebArgValue, String)), List(HTML_Partial_Content) | ||
| 411 | ) = construct_selector_hide_show(div_id, items, [], [], 0). | 411 | ) = construct_selector_hide_show(div_id, items, [], [], 0). |
| 412 | 412 | ||
| 413 | public define HTML_In_Form | 413 | public define HTML_In_Form |
| 414 | + format_div_CXM_Form_Field | ||
| 415 | + ( | ||
| 416 | + CXM_Form_Field field, | ||
| 417 | + List(Web_arg) lwa, | ||
| 418 | + String _class | ||
| 419 | + ). | ||
| 420 | + | ||
| 421 | +public define HTML_In_Form | ||
| 414 | format_CXM_Form_Field | 422 | format_CXM_Form_Field |
| 415 | ( | 423 | ( |
| 416 | CXM_Form_Field ff, | 424 | CXM_Form_Field ff, |
| @@ -500,7 +508,7 @@ public define HTML_In_Form | @@ -500,7 +508,7 @@ public define HTML_In_Form | ||
| 500 | with div_id = generate_random_string(15), | 508 | with div_id = generate_random_string(15), |
| 501 | sequence([ | 509 | sequence([ |
| 502 | 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)), | 510 | 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)), |
| 503 | - 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))) | 511 | + 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))) |
| 504 | ]), | 512 | ]), |
| 505 | 513 | ||
| 506 | radio_button(options, _label, id, wan, val, checked, mand) then | 514 | radio_button(options, _label, id, wan, val, checked, mand) then |
| @@ -510,7 +518,7 @@ public define HTML_In_Form | @@ -510,7 +518,7 @@ public define HTML_In_Form | ||
| 510 | with div_id = generate_random_string(15), | 518 | with div_id = generate_random_string(15), |
| 511 | sequence([ | 519 | sequence([ |
| 512 | 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)), | 520 | 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)), |
| 513 | - 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))) | 521 | + 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))) |
| 514 | ]), | 522 | ]), |
| 515 | 523 | ||
| 516 | radio_buttonr(options, _label, id, wan, val, checked, mand) then | 524 | radio_buttonr(options, _label, id, wan, val, checked, mand) then |
| @@ -568,7 +576,7 @@ public define HTML_In_Form | @@ -568,7 +576,7 @@ public define HTML_In_Form | ||
| 568 | sequence([ | 576 | sequence([ |
| 569 | literal("<fieldset" + format_attrs(options) + ">"), | 577 | literal("<fieldset" + format_attrs(options) + ">"), |
| 570 | literal(if length(legend) > 0 then "<legend>" + legend + "</legend>" else ""), | 578 | literal(if length(legend) > 0 then "<legend>" + legend + "</legend>" else ""), |
| 571 | - sequence( map((CXM_Form_Field ffield) |-> div([class("form_field")], format_CXM_Form_Field(ffield, lwa)), fields) ), | 579 | + sequence( map((CXM_Form_Field ffield) |-> format_div_CXM_Form_Field(ffield, lwa, "form_field"), fields) ), |
| 572 | literal("</fieldset>") | 580 | literal("</fieldset>") |
| 573 | ]), | 581 | ]), |
| 574 | 582 | ||
| @@ -593,12 +601,34 @@ public define HTML_In_Form | @@ -593,12 +601,34 @@ public define HTML_In_Form | ||
| 593 | }. | 601 | }. |
| 594 | 602 | ||
| 595 | public define HTML_In_Form | 603 | public define HTML_In_Form |
| 604 | + format_div_CXM_Form_Field | ||
| 605 | + ( | ||
| 606 | + CXM_Form_Field field, | ||
| 607 | + List(Web_arg) lwa, | ||
| 608 | + String _class | ||
| 609 | + )= | ||
| 610 | + if field is empty then | ||
| 611 | + empty | ||
| 612 | + else if field is no_field then | ||
| 613 | + empty | ||
| 614 | + else if field is hidden(id, name, init) then | ||
| 615 | + format_CXM_Form_Field(field, lwa) | ||
| 616 | + else if field is br then | ||
| 617 | + format_CXM_Form_Field(field, lwa) | ||
| 618 | + else | ||
| 619 | + div([class(_class)], format_CXM_Form_Field(field, lwa)) | ||
| 620 | +. | ||
| 621 | + | ||
| 622 | +public define HTML_In_Form | ||
| 596 | format_CXM_Form_Field | 623 | format_CXM_Form_Field |
| 597 | ( | 624 | ( |
| 598 | List(CXM_Form_Field) fields, | 625 | List(CXM_Form_Field) fields, |
| 599 | List(Web_arg) lwa | 626 | List(Web_arg) lwa |
| 600 | )= | 627 | )= |
| 601 | - sequence( map((CXM_Form_Field ff) |-> div([class("form_field aligned")], format_CXM_Form_Field(ff, lwa)), fields) ). | 628 | + sequence( map((CXM_Form_Field ff) |
| 629 | + |-> | ||
| 630 | + format_div_CXM_Form_Field(ff, lwa, "form_field aligned"), fields)) | ||
| 631 | +. | ||
| 602 | 632 | ||
| 603 | public define HTML_In_Form | 633 | public define HTML_In_Form |
| 604 | fieldset | 634 | fieldset |
| @@ -606,7 +636,17 @@ public define HTML_In_Form | @@ -606,7 +636,17 @@ public define HTML_In_Form | ||
| 606 | List(Web_arg) lwa, | 636 | List(Web_arg) lwa, |
| 607 | List(CXM_Form_Field) fields, | 637 | List(CXM_Form_Field) fields, |
| 608 | )= | 638 | )= |
| 609 | - sequence( map((CXM_Form_Field ff) |-> div([class("form_field aligned")], format_CXM_Form_Field(ff, lwa)), fields) ). | 639 | + sequence( map((CXM_Form_Field ff) |-> |
| 640 | + if ff is empty then | ||
| 641 | + empty | ||
| 642 | + else if ff is no_field then | ||
| 643 | + empty | ||
| 644 | + else if ff is hidden(id, name, init) then | ||
| 645 | + format_CXM_Form_Field(ff, lwa) | ||
| 646 | + else if ff is br then | ||
| 647 | + format_CXM_Form_Field(ff, lwa) | ||
| 648 | + else | ||
| 649 | + div([class("form_field aligned")], format_CXM_Form_Field(ff, lwa)), fields) ). | ||
| 610 | 650 | ||
| 611 | public define HTML_In_Form | 651 | public define HTML_In_Form |
| 612 | fieldset | 652 | fieldset |
| @@ -614,7 +654,17 @@ public define HTML_In_Form | @@ -614,7 +654,17 @@ public define HTML_In_Form | ||
| 614 | List(Web_arg) lwa, | 654 | List(Web_arg) lwa, |
| 615 | CXM_Form_Field field, | 655 | CXM_Form_Field field, |
| 616 | )= | 656 | )= |
| 617 | - div([class("form_field aligned")], format_CXM_Form_Field(field, lwa)). | 657 | + if field is empty then |
| 658 | + empty | ||
| 659 | + else if field is no_field then | ||
| 660 | + empty | ||
| 661 | + else if field is hidden(id, name, init) then | ||
| 662 | + format_CXM_Form_Field(field, lwa) | ||
| 663 | + else if field is br then | ||
| 664 | + format_CXM_Form_Field(field, lwa) | ||
| 665 | + else | ||
| 666 | + div([class("form_field aligned")], format_CXM_Form_Field(field, lwa)) | ||
| 667 | +. | ||
| 618 | 668 | ||
| 619 | 669 | ||
| 620 | public define HTML_In_Form | 670 | public define HTML_In_Form |
| @@ -622,7 +672,17 @@ public define HTML_In_Form | @@ -622,7 +672,17 @@ public define HTML_In_Form | ||
| 622 | ( | 672 | ( |
| 623 | List(CXM_Form_Field) fields | 673 | List(CXM_Form_Field) fields |
| 624 | )= | 674 | )= |
| 625 | - sequence( map((CXM_Form_Field ff) |-> div([class("form_field aligned")], format_CXM_Form_Field(ff, [])), fields) ). | 675 | + sequence( map((CXM_Form_Field ff) |-> |
| 676 | + if ff is empty then | ||
| 677 | + empty | ||
| 678 | + else if ff is no_field then | ||
| 679 | + empty | ||
| 680 | + else if ff is hidden(id, name, init) then | ||
| 681 | + format_CXM_Form_Field(ff, []) | ||
| 682 | + else if ff is br then | ||
| 683 | + format_CXM_Form_Field(ff, []) | ||
| 684 | + else | ||
| 685 | + div([class("form_field aligned")], format_CXM_Form_Field(ff, [])), fields) ). | ||
| 626 | 686 | ||
| 627 | 687 | ||
| 628 | public define HTML_Off_Form | 688 | public define HTML_Off_Form |