Skip to content

Commit 8c8dfdd

Browse files
committed
Updated code based on review
1 parent 857397e commit 8c8dfdd

File tree

3 files changed

+40
-18
lines changed

3 files changed

+40
-18
lines changed

library/server/wsf_html/form/wsf_form_field_with_numeric_attribute.e

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ inherit
1717

1818
feature -- Access
1919

20-
min: detachable READABLE_STRING_32
20+
min: detachable READABLE_STRING_8
2121
-- minimun value accepted by Current field.
2222

23-
max: detachable READABLE_STRING_32
23+
max: detachable READABLE_STRING_8
2424
-- maximun value accepted by Current field.
2525

26-
step: detachable READABLE_STRING_32
26+
step: detachable READABLE_STRING_8
2727
-- step is the increment that the value should adjust up or down, with the default step value being 1.
2828

2929
feature -- Element Change
@@ -52,28 +52,46 @@ feature -- Element Change
5252
step_set: attached step as l_step implies l_step.same_string (a_val.out)
5353
end
5454

55-
set_min_string (a_val: READABLE_STRING_32)
55+
set_min_string (a_val: READABLE_STRING_GENERAL)
5656
-- Set `min' with `a_val'.
57+
require
58+
is_valid_number: a_val.is_integer
5759
do
58-
min := a_val
60+
if a_val.is_string_32 then
61+
min := html_encoder.encoded_string (a_val.as_string_32)
62+
elseif a_val.is_string_8 then
63+
min := a_val.as_string_8
64+
end
5965
ensure
60-
min_set: attached min as l_min implies l_min = a_val
66+
min_set: attached min as l_min implies l_min.same_string_general (a_val)
6167
end
6268

63-
set_max_string (a_val: READABLE_STRING_32)
69+
set_max_string (a_val: READABLE_STRING_GENERAL)
6470
-- Set `max' with `a_val'.
71+
require
72+
is_valid_number: a_val.is_integer
6573
do
66-
max := a_val
74+
if a_val.is_string_32 then
75+
max := html_encoder.encoded_string (a_val.as_string_32)
76+
elseif a_val.is_string_8 then
77+
max := a_val.as_string_8
78+
end
6779
ensure
68-
max_set: attached max as l_max implies l_max = a_val
80+
max_set: attached max as l_max implies l_max.same_string_general (a_val)
6981
end
7082

71-
set_step_string (a_val: READABLE_STRING_32)
83+
set_step_string (a_val: READABLE_STRING_GENERAL)
7284
-- Set `step' with `a_val'.
73-
do
74-
step := a_val
85+
require
86+
is_valid_sequence: a_val.is_number_sequence or else a_val.is_real_sequence
87+
do
88+
if a_val.is_string_32 then
89+
step := html_encoder.encoded_string (a_val.as_string_32)
90+
elseif a_val.is_string_8 then
91+
step := a_val.as_string_8
92+
end
7593
ensure
76-
step_set: attached step as l_step implies l_step = a_val
94+
step_set: attached step as l_step implies l_step.same_string_general (a_val)
7795
end
7896

7997

@@ -85,21 +103,21 @@ feature {NONE} -- Conversion
85103
--min
86104
if attached min as l_min then
87105
a_target.append (" min=%"")
88-
a_target.append (html_encoder.encoded_string (l_min))
106+
a_target.append(l_min)
89107
a_target.append_character ('%"')
90108
end
91109

92110
--max
93111
if attached max as l_max then
94112
a_target.append (" max=%"")
95-
a_target.append (html_encoder.encoded_string (l_max))
113+
a_target.append (l_max)
96114
a_target.append_character ('%"')
97115
end
98116

99117
--step
100118
if attached step as l_step then
101119
a_target.append (" step=%"")
102-
a_target.append (html_encoder.encoded_string (l_step))
120+
a_target.append (l_step)
103121
a_target.append_character ('%"')
104122
end
105123
end

library/server/wsf_html/form/wsf_form_input_with_html5.e

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ feature -- Change element
6060
end
6161

6262
disable_autocomplete
63-
-- Turn off the autocompelte. The default behavior is on.
63+
-- Turn off the autocomplete. The default behavior is on.
6464
do
6565
autocomplete := True
6666
ensure

library/server/wsf_html/form/wsf_form_month_input.e

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
note
2-
description: "Summary description for {WSF_FORM_MONTH_INPUT}."
2+
description: "[
3+
Represent an input type Month
4+
Example:
5+
<input id="expiry" name="expiry" type="month" required>
6+
]"
37
date: "$Date$"
48
revision: "$Revision$"
59
EIS: "name=month", "src=https://html.spec.whatwg.org/multipage/forms.html#month-state-(type=month)"

0 commit comments

Comments
 (0)