module HtmlGrid::FormMethods

Constants

ACCEPT_CHARSET
AUTOFILL
EVENT
FORM_ACTION
FORM_METHOD
FORM_NAME
TAG_METHOD

Public Instance Methods

autofill?() click to toggle source
# File lib/htmlgrid/form.rb, line 39
def autofill?
  self.class.const_get(:AUTOFILL)
end
event() click to toggle source
# File lib/htmlgrid/form.rb, line 43
def event
  self.class::EVENT
end
formname() click to toggle source
# File lib/htmlgrid/form.rb, line 47
def formname
  if defined? self.class::FORM_NAME
    self.class::FORM_NAME
  end
end
onsubmit=(onsubmit) click to toggle source
# File lib/htmlgrid/form.rb, line 53
def onsubmit=(onsubmit)
  @form_properties["onSubmit"] = onsubmit
end
to_html(context) click to toggle source
Calls superclass method
# File lib/htmlgrid/form.rb, line 57
def to_html(context)
  context.send(self.class::TAG_METHOD, @form_properties) {
    super << context.div("style" => "display:none") { hidden_fields(context) }
  }
end

Private Instance Methods

hidden_fields(context) click to toggle source
# File lib/htmlgrid/form.rb, line 65
def hidden_fields(context)
  "" <<
    context.hidden("flavor", @lookandfeel.flavor) <<
    context.hidden("language", @lookandfeel.language) <<
    context.hidden({"NAME" => "event", "ID" => "event",
                    "VALUE" => event.to_s}) <<
    context.hidden("state_id", @session.state.object_id.to_s)
end
init() click to toggle source
Calls superclass method
# File lib/htmlgrid/form.rb, line 74
def init
  @form_properties = {}
  if defined? self.class::FORM_CSS_CLASS
    @form_properties.store("class", self.class::FORM_CSS_CLASS)
  end
  if defined? self.class::FORM_NAME
    @form_properties.store("NAME", self.class::FORM_NAME)
  end
  if defined? self.class::FORM_ID
    @form_properties.store("ID", self.class::FORM_ID)
  end
  super
  @form_properties.update({
    "METHOD"        =>     self.class::FORM_METHOD.dup,
    "ACTION"        =>     (self.class::FORM_ACTION || @lookandfeel.base_url),
    "ACCEPT-CHARSET"        =>     self.class::ACCEPT_CHARSET
  })
end