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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'lib/cuca/stdlib/form.rb', line 109
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
92
93
94
95
96
97
|
# File 'lib/cuca/stdlib/form.rb', line 92
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
88
89
90
|
# File 'lib/cuca/stdlib/form.rb', line 88
def setup
@demo_input = "enter something"
end
|
#validate ⇒ Object
100
101
102
103
104
105
106
107
|
# File 'lib/cuca/stdlib/form.rb', line 100
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
|