diff --git a/calexium_lib/web/CXM_generic_form.anubis b/calexium_lib/web/CXM_generic_form.anubis index 7563973..d0aac46 100644 --- a/calexium_lib/web/CXM_generic_form.anubis +++ b/calexium_lib/web/CXM_generic_form.anubis @@ -17,6 +17,7 @@ read CXM_making_a_web_site.anubis +read tools/basis.anubis public type Mandatory: // used to mark fields as mandatory. @@ -50,25 +51,25 @@ public type FormField: message_f (Result(List(Text_Option) -> HTML_In_Form,List(Text_Option) -> HTML_In_Form)), //--- text input field ---------------------------------------------------------------- - input (String web_arg_name, + input (WebArgName web_arg_name, String tag, Width width, - String init_value, + InitialValue init_value, Mandatory mandatory), - input (String web_arg_name, + input (WebArgName web_arg_name, Width width, - String init_value), - input_f (String web_arg_name, + InitialValue init_value), + input_f (WebArgName web_arg_name, List(Text_Option) -> HTML_In_Form tag, Width width, - String init_value, + InitialValue init_value, Mandatory mandatory), //--- password input field ------------------------------------------------------------ - password_input (String web_arg_name, + password_input (WebArgName web_arg_name, String tag, Mandatory mandatory), - password_input_f (String web_arg_name, + password_input_f (WebArgName web_arg_name, List(Text_Option) -> HTML_In_Form tag, Mandatory mandatory), @@ -79,61 +80,61 @@ public type FormField: explain_f (List(Text_Option) -> HTML_In_Form), //--- selector field ------------------------------------------------------------------ - selector (String web_arg_name, + selector (WebArgName web_arg_name, String tag, List(String) items, - Maybe(String) selected, + Maybe(InitialValue) selected, Mandatory mandatory), - selector_f (String web_arg_name, + selector_f (WebArgName web_arg_name, List(Text_Option) -> HTML_In_Form, List(String) items, - Maybe(String) selected, + Maybe(InitialValue) selected, Mandatory mandatory), - selector_c (String web_arg_name, + selector_c (WebArgName web_arg_name, String tag, - List((String,String)) items, - Maybe(String) selected, + List((WebArgValue,String)) items, + Maybe(InitialValue) selected, Mandatory mandatory), //--- checkbox field ------------------------------------------------------------------ - checkbox (String web_arg_name, + checkbox (WebArgName web_arg_name, String tag, Bool checked, Mandatory mandatory), // the same one, but with the tag on the right of the checkbox - checkboxr (String web_arg_name, + checkboxr (WebArgName web_arg_name, String tag, Bool checked, Mandatory mandatory), - checkbox_f (String web_arg_name, + checkbox_f (WebArgName web_arg_name, List(Text_Option) -> HTML_In_Form, Bool checked, Mandatory mandatory), //--- radio-button field -------------------------------------------------------------- - radio_button (String web_arg_name, - String web_arg_value, + radio_button (WebArgName web_arg_name, + WebArgValue web_arg_value, String tag, Bool checked, Mandatory mandatory), // the same one, but with the tag on the right of the radio_button - radio_buttonr (String web_arg_name, - String web_arg_value, + radio_buttonr (WebArgName web_arg_name, + WebArgValue web_arg_value, String tag, Bool checked, Mandatory mandatory), //--- text area field ----------------------------------------------------------------- - text_area (String web_arg_name, - String initial_text), - text_area (String web_arg_name, + text_area (WebArgName web_arg_name, + InitialValue initial_text), + text_area (WebArgName web_arg_name, String tag, - String initial_text), - text_area (String web_arg_name, + InitialValue initial_text), + text_area (WebArgName web_arg_name, String tag, - String initial_text, + InitialValue initial_text, Int32 width, Int32 height), @@ -161,24 +162,24 @@ public type FormField: public define FormField title(List(Text_Option) -> HTML_In_Form f) = title_f(f). public define FormField message(Result(List(Text_Option) -> HTML_In_Form,List(Text_Option) -> HTML_In_Form) f) = message_f(f). -public define FormField input(String web_arg_name, +public define FormField input(WebArgName web_arg_name, List(Text_Option) -> HTML_In_Form tag, Width width, - String init_value, + InitialValue init_value, Mandatory mandatory) = input_f(web_arg_name,tag,width,init_value,mandatory). -public define FormField password_input(String web_arg_name, +public define FormField password_input(WebArgName web_arg_name, List(Text_Option) -> HTML_In_Form tag, Mandatory mandatory) = password_input_f(web_arg_name,tag,mandatory). public define FormField explain(List(Text_Option) -> HTML_In_Form f) = explain_f(f). -public define FormField selector(String web_arg_name, +public define FormField selector(WebArgName web_arg_name, List(Text_Option) -> HTML_In_Form f, List(String) items, - Maybe(String) selected, + Maybe(InitialValue) selected, Mandatory mandatory) = selector_f(web_arg_name,f,items,selected,mandatory). -public define FormField checkbox(String web_arg_name, +public define FormField checkbox(WebArgName web_arg_name, List(Text_Option) -> HTML_In_Form f, Bool checked, Mandatory mandatory) @@ -200,7 +201,7 @@ public define HTML_Off_Form --- That's all for the public part ! -------------------------------------------------- // TO DO update code of CXM generic form - define HTML_Row(HTML_In_Form) +define HTML_Row(HTML_In_Form) format_form_field ( FormField ff @@ -249,7 +250,7 @@ public define HTML_Off_Form [ cell([right ], text([size(10)],tag)), cell([width(7) ], star(mand)), - cell([left ], text_input("","",wan,init,if w is + cell([left ], text_input([], "",htmlId(""),wan,init,if w is { small then 10, narrow then 30, @@ -260,7 +261,7 @@ public define HTML_Off_Form input(wan,w,init) then (List(HTML_Cell(HTML_In_Form))) [ - cell([left,columns(3) ], text_input("","",wan,init,if w is + cell([left,columns(3) ], text_input([], "", htmlId(""), wan,init,if w is { small then 10, narrow then 30, @@ -273,7 +274,7 @@ public define HTML_Off_Form [ cell([right ], tag([size(10)])), cell([width(7) ], star(mand)), - cell([left ], text_input("","",wan,init,if w is + cell([left ], text_input([], "", htmlId(""),wan,init,if w is { small then 15, narrow then 30, @@ -286,14 +287,14 @@ public define HTML_Off_Form [ cell([right ], text([size(10)],tag)), cell([width(7) ], star(mand)), - cell([left ], password_input("","",wan,30)) + cell([left ], password_input([], "",htmlId(""), wan, init(""), 30)) ], password_input_f(wan,tag,mand) then (List(HTML_Cell(HTML_In_Form))) [ cell([right ], tag([size(10)])), cell([width(7) ], star(mand)), - cell([left ], password_input("","",wan,30)) + cell([left ], password_input([], "",htmlId(""), wan, init(""), 30)) ], explain(t) then (List(HTML_Cell(HTML_In_Form))) @@ -328,8 +329,8 @@ public define HTML_Off_Form cell([width(7)], star(mand)), cell([left ], if selected is { - failure then selector(wan,1,items) - success(sel) then selector(wan,1,items,sel) + failure then selector([], "", htmlId(""), wan,1,items) + success(sel) then selector([], "", htmlId(""), wan,1,items, sel) }) ], @@ -339,8 +340,8 @@ public define HTML_Off_Form cell([width(7)], star(mand)), cell([left ], if selected is { - failure then selector(wan,1,items) - success(sel) then selector(wan,1,items,sel) + failure then selector([], "", htmlId(""), wan,1,items) + success(sel) then selector([], "", htmlId(""), wan,1,items, sel) }) ], @@ -350,8 +351,8 @@ public define HTML_Off_Form cell([width(7)], star(mand)), cell([left ], if selected is { - failure then selector_c(wan,1,items) - success(sel) then selector_c(wan,1,items,sel) + failure then selector_c([], "", htmlId(""), wan,1,items) + success(sel) then selector_c([], "", htmlId(""), wan,1,items,sel) }) ], @@ -359,12 +360,12 @@ public define HTML_Off_Form [ cell([right ], text([size(10)],tag)), cell([width(7)], star(mand)), - cell([left ], check_box("","",wan,checked)) + cell([left ], check_box([], "",htmlId(""),wan, wav(wan.name),checked)) ], checkboxr(wan,tag,checked,mand) then (List(HTML_Cell(HTML_In_Form))) [ - cell([right ], check_box("","",wan,checked)), + cell([right ], check_box([], "",htmlId(""),wan, wav(wan.name),checked)), cell([width(7)], star(mand)), cell([left ], text([size(10)],tag)) ], @@ -373,19 +374,19 @@ public define HTML_Off_Form [ cell([right ], tag([size(10)])), cell([width(7)], star(mand)), - cell([left ], check_box("","",wan,checked)) + cell([left ], check_box([], "",htmlId(""),wan,wav(wan.name),checked)) ], radio_button(wan,wav,tag,checked,mand) then (List(HTML_Cell(HTML_In_Form))) [ cell([right ], text([size(10)],tag)), cell([width(7)], star(mand)), - cell([left ], radio_button("","",wan,wav,checked)) + cell([left ], radio_button([], "", htmlId(""), wan, wav, checked)) ], radio_buttonr(wan,wav,tag,checked,mand) then (List(HTML_Cell(HTML_In_Form))) [ - cell([right ], radio_button("","",wan,wav,checked)), + cell([right ], radio_button([], "", htmlId(""), wan, wav, checked)), cell([width(7)], star(mand)), cell([left ], text([size(10)],tag)) ], @@ -454,7 +455,7 @@ public define HTML_Off_Form // TO DO update code of CXM generic form - public define HTML_Off_Form +public define HTML_Off_Form generic_form ( String form_name, @@ -465,6 +466,6 @@ public define HTML_Off_Form table([border(0,0,5,bg_color),percentage_width(100), background_color(bg_color)],[row(cell([h_center], form(form_name,[],table([border(0,2,0,bg_color)], - map(format_form_field,fields)))))]). + map(format_form_field, fields)))))]). diff --git a/calexium_lib/web/CXM_making_a_web_site.anubis b/calexium_lib/web/CXM_making_a_web_site.anubis index 0fbae46..9c5d48f 100644 --- a/calexium_lib/web/CXM_making_a_web_site.anubis +++ b/calexium_lib/web/CXM_making_a_web_site.anubis @@ -989,7 +989,7 @@ public type HTML_In_Form: text_input (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int32 width), text_input_ro (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int32 width), password_input (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int32 width), - text_area (List(TextAreaOption), String name, String init, Int32 width, Int32 height), + text_area (List(TextAreaOption), WebArgName name, InitialValue init, Int32 width, Int32 height), file_upload (String label, HtmlId id, WebArgName name, Int32 width), selector (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int32 size, List(String) choices), selector (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int32 size, List(String) choices, InitialValue selected), @@ -1037,8 +1037,8 @@ public define HTML_In_Form public define HTML_In_Form text_area ( - String name, - String init, + WebArgName name, + InitialValue init, Int32 width, Int32 height ) = -- libgit2 0.21.4