Class: Web::Narflates::Form

Inherits:
Object show all
Defined in:
lib/web/template.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(formname, method, contents, query) ⇒ Form

Returns a new instance of Form.



255
256
257
258
259
260
# File 'lib/web/template.rb', line 255

def initialize (formname,method,contents,query)
  @formname = formname
  @method = method
  @contents = contents
  @query = query
end

Instance Attribute Details

#formnameObject (readonly)

Returns the value of attribute formname.



254
255
256
# File 'lib/web/template.rb', line 254

def formname
  @formname
end

#methodObject (readonly)

Returns the value of attribute method.



254
255
256
# File 'lib/web/template.rb', line 254

def method
  @method
end

Instance Method Details



262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/web/template.rb', line 262

def print (globals,io) 
  io << "<form name=\"#{@formname}\" method=\"#{@method}\">"
  io << "<input type=\"hidden\" name=\"__submitted\" value=\"#{@formname}\">"
  @query.each do | k,v|
    io << "<input type=\"hidden\" name=\"__q.#{k}\" value=\"" + v.gsub(/"/,"&quot;") +"\">"
  end

  @contents.each do |i|
    i.print(globals,io)
  end
  io << "</form>"
end