Began with implementation of form handling

This commit is contained in:
Severin Münger
2013-09-05 15:37:59 +02:00
parent 422b73058c
commit ee0400463f
5 changed files with 65 additions and 9 deletions

View File

@@ -22,4 +22,8 @@ feature {NONE}
tag_name := "form"
end
feature
end

View File

@@ -4,18 +4,31 @@ note
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_FORM_ELEMENT_CONTROL
class
WSF_FORM_ELEMENT_CONTROL [G]
inherit
WSF_CONTROL
feature
is_valid(value: STRING):BOOLEAN
do
end
is_valid (value: G): BOOLEAN
do
if attached validate as v then
Result := v.item ([value])
else
Result := True
end
end
validate: detachable FUNCTION[ANY, TUPLE[STRING], BOOLEAN]
feature
value_control: WSF_VALUE_CONTROL[G]
validate: detachable FUNCTION [ANY, TUPLE [G], BOOLEAN]
end

View File

@@ -11,6 +11,8 @@ inherit
WSF_CONTROL
WSF_VALUE_CONTROL [STRING]
create
make_text
@@ -57,11 +59,11 @@ feature --EVENT HANDLING
end
end
feature
feature -- Implementation
render: STRING
do
Result := "<input type=%"text%" data-name=%"" + control_name + "%" data-type=%"WSF_TEXT_CONTROL%" value=%"" + text + "%" />"
Result := render_tag ("", "value=%"" + text + "%"")
end
set_text (t: STRING)
@@ -72,6 +74,11 @@ feature
end
end
value: STRING
do
Result := text
end
feature
text: STRING

View File

@@ -0,0 +1,16 @@
note
description: "Summary description for {WSF_VALIDATOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_VALIDATOR
create
make
feature {NONE}
end

View File

@@ -0,0 +1,16 @@
note
description: "Summary description for {WSF_VALUE_CONTROL}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_VALUE_CONTROL [G]
feature
value: G
deferred
end
end