Esempio n. 1
0
func (self *TextArea) Render(context *Context, writer *utils.XMLWriter) (err error) {
	writer.OpenTag("textarea").Attrib("id", self.id).AttribIfNotDefault("class", self.Class)

	cols := self.Cols
	if cols == 0 {
		cols = TextAreaDefaultCols
	}
	rows := self.Rows
	if rows == 0 {
		rows = TextAreaDefaultRows
	}

	writer.Attrib("name", self.Name)
	writer.Attrib("rows", rows)
	writer.Attrib("cols", cols)
	writer.AttribIfNotDefault("tabindex", self.TabIndex)
	if self.Readonly {
		writer.Attrib("readonly", "readonly")
	}
	if self.Disabled {
		writer.Attrib("disabled", "disabled")
	}

	writer.EscapeContent(self.Text)
	writer.CloseTag()
	return nil
}