Fix render function

This commit is contained in:
YNH Webdev
2013-09-05 16:51:37 +02:00
parent f52f6512a0
commit ad15ab13c5
3 changed files with 21 additions and 12 deletions

View File

@@ -22,19 +22,19 @@ feature
initialize_controls initialize_controls
local local
panel: WSF_MULTI_CONTROL form: WSF_FORM_CONTROL
do do
create textbox1.make_text ("txtBox1", "1") create textbox1.make_text ("txtBox1", "1")
create textbox2.make_text ("txtBox2", "2") create textbox2.make_text ("txtBox2", "2")
create button1.make_button ("sample_button1", "SUM") create button1.make_button ("sample_button1", "SUM")
create textbox_result.make_text ("txtBox3", "") create textbox_result.make_text ("txtBox3", "")
button1.set_click_event (agent handle_click) button1.set_click_event (agent handle_click)
create panel.make ("panel") create form.make_form_control ("panel")
panel.add_control (textbox1) form.add_control (create {WSF_FORM_ELEMENT_CONTROL[STRING]}.make_form_element("Number1",textbox1))
panel.add_control (textbox2) form.add_control (textbox2)
panel.add_control (button1) form.add_control (button1)
panel.add_control (textbox_result) form.add_control (textbox_result)
control := panel control := form
end end
handle_click handle_click

View File

@@ -92,7 +92,7 @@ feature
css_classes_string := " class=%"" + css_classes_string + "%"" css_classes_string := " class=%"" + css_classes_string + "%""
end end
Result := "<" + tag_name + " data-name=%"" + control_name + "%" data-type=%"" + generator + "%" " + attributes + css_classes_string Result := "<" + tag_name + " data-name=%"" + control_name + "%" data-type=%"" + generator + "%" " + attributes + css_classes_string
if not body.is_empty then if body.is_empty then
Result := Result + " />" Result := Result + " />"
else else
Result := Result + " >" + body + "</" + tag_name + ">" Result := Result + " >" + body + "</" + tag_name + ">"

View File

@@ -12,18 +12,27 @@ inherit
WSF_CONTROL WSF_CONTROL
create create
make_form_element make_form_element,
make_form_element_with_validators
feature {NONE} feature {NONE}
make_form_element (n: STRING; c: WSF_VALUE_CONTROL [G]; v: LINKED_LIST [WSF_VALIDATOR [G]]) make_form_element (a_label:STRING; c: WSF_VALUE_CONTROL [G])
local
a_validators: LINKED_LIST [WSF_VALIDATOR [G]]
do do
make (n, "div") create a_validators.make
make_form_element_with_validators(a_label,c,a_validators)
end
make_form_element_with_validators (a_label: STRING; c: WSF_VALUE_CONTROL [G]; v: LINKED_LIST [WSF_VALIDATOR [G]])
do
make (c.control_name+"_container", "div")
add_class ("form-group") add_class ("form-group")
c.add_class ("form-control") c.add_class ("form-control")
value_control := c value_control := c
validators := v validators := v
label := "" label := a_label
error := "" error := ""
end end