Class: TestFormWidget
Instance Method Summary
collapse
#mab, #mabtext
Methods inherited from FormWidget
#get_variables, #load_variables, #on_submit, #output, #posted?
#app, #cgi, #clear, clear_hints, #content, #content=, #controller, define_attr_method, #escape, #escapeHTML, #get_assigns, #hints, #initialize, #log, #output, #params, #query_parameters, #request_method, #request_parameters, run_attr_method, #session, #to_s, #unescape, #unescapeHTML
Constructor Details
This class inherits a constructor from Cuca::Widget
Instance Method Details
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
# File 'lib/cuca/stdlib/form.rb', line 122
def form
mab {
FormErrors(@form_errors)
form( :action=>@post_to, :method=>'post') { text "This is a demo form, overwrite 'form' method. Enter 'demo'"
br
E('demo_input', true) { input(:type => 'text', :value => @demo_input, :name=>'demo_input'); text @error_text }
br
br
input(:type => 'submit', :value => 'save', :name => @submit_name)
}
}
end
|
#make_tips ⇒ Object
105
106
107
108
109
110
|
# File 'lib/cuca/stdlib/form.rb', line 105
def make_tips
@form_errors.each_pair do |k,v|
hints[:tips] ||= []
hints[:tips] << { :id => k, :title => "Error in form", :text => v}
end
end
|
#setup ⇒ Object
101
102
103
|
# File 'lib/cuca/stdlib/form.rb', line 101
def setup
@demo_input = "enter something"
end
|
#validate ⇒ Object
113
114
115
116
117
118
119
120
|
# File 'lib/cuca/stdlib/form.rb', line 113
def validate
if @demo_input != 'demo' then
@form_errors['demo_input'] = "I said please enter 'demo' but you entered #{@demo_input}"
end
make_tips
true
end
|