class HRadioButtonTag

Attributes

radioButton[RW]

Public Class Methods

new(name = nil, modelName = nil, placeholder = nil) click to toggle source
Calls superclass method HGroupTag::new
# File lib/hwidgets/hradiobuttontag.rb, line 9
def initialize(name = nil, modelName = nil, placeholder = nil)
  super(name, modelName, placeholder)
  @radioButton = nil
end

Public Instance Methods

html() click to toggle source
Calls superclass method HGroupTag#html
# File lib/hwidgets/hradiobuttontag.rb, line 14
def html()
  for i in (0..@items.count - 1) do
    item = @items[i]
    value = @values[i]
    id = "#{@modelName}_#{@name}_#{item.downcase.gsub(' ', '_')}"
    radioButton = HInputTag.new(@name, @modelName, item, nil, type = "radio") if (@radioButton == nil)
    radioButton.set("checked", "") if (value.to_s == @selectedItem.to_s)
    radioButton.set(value: value, id: id)
    radioButton.setReverse()
    self << radioButton
  end

  return super()

end