Fix form and textarea bug

This commit is contained in:
YNH Webdev
2013-09-05 17:43:46 +02:00
parent 32518cfb41
commit 0c265f4f78
3 changed files with 37 additions and 17 deletions

View File

@@ -69,7 +69,7 @@ class WSF_TEXTAREA_CONTROL extends WSF_CONTROL
update: (state) -> update: (state) ->
if state.text? if state.text?
window.states[@control_name]['text'] = state.text window.states[@control_name]['text'] = state.text
$el.val(state.text) @$el.val(state.text)
#map class name to effective class #map class name to effective class
typemap = typemap =

View File

@@ -136,7 +136,7 @@
WSF_TEXTAREA_CONTROL.prototype.update = function(state) { WSF_TEXTAREA_CONTROL.prototype.update = function(state) {
if (state.text != null) { if (state.text != null) {
window.states[this.control_name]['text'] = state.text; window.states[this.control_name]['text'] = state.text;
return $el.val(state.text); return this.$el.val(state.text);
} }
}; };

View File

@@ -11,7 +11,7 @@ inherit
WSF_CONTROL WSF_CONTROL
redefine redefine
read_state_changes read_state_changes,load_state,read_state
end end
create create
@@ -48,33 +48,53 @@ feature
loop loop
end end
end end
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
feature --Implementation load_state (new_states: JSON_OBJECT)
-- Pass new_states to subcontrols
do
Precursor (new_states)
value_control.load_state (new_states)
end
set_state (new_state: JSON_OBJECT) set_state (new_state: JSON_OBJECT)
do do
value_control.set_state (new_state) value_control.set_state(new_state)
end end
state: JSON_OBJECT read_state (states: JSON_OBJECT)
-- Read states in subcontrols
do do
Result := value_control.state Precursor (states)
end value_control.read_state(states)
handle_callback (cname, event: STRING_8)
do
value_control.handle_callback (cname, event)
end end
read_state_changes (states: JSON_OBJECT) read_state_changes (states: JSON_OBJECT)
-- Add a new entry in the `states_changes` JSON object with the `control_name` as key and the `state` as value -- Read states_changes in subcontrols
do do
if state_changes.count > 0 then Precursor (states)
states.put (state_changes, create {JSON_STRING}.make_json (control_name)) value_control.read_state_changes(states)
end
value_control.read_state_changes (states)
end end
state: JSON_OBJECT
--Read state
do
create Result.make
end
feature --EVENT HANDLING
handle_callback (cname: STRING; event: STRING)
-- Pass callback to subcontrols
do
if equal (cname, control_name) then
else
value_control.handle_callback (cname, event)
end
end
feature --Implementation
render: STRING render: STRING
local local
body: STRING body: STRING