sailorproject / sailor

A Lua MVC Web Framework.
MIT License
926 stars 123 forks source link

form.textarea adds spaces to content! #166

Closed d9k closed 6 years ago

d9k commented 6 years ago

proposed fix:

 function form.textarea(model,attribute,html_options)
        local t = pack(defaults(model,attribute,html_options))
+  t[4] = nil; t.n = 3
        tinsert(t,1,'<textarea')
-       tinsert(t,'>')
-       tinsert(t,model[attribute] or 'asadas')
-       tinsert(t,'</textarea>')
+  -- TODO html encode?
+       tinsert(t,'>' .. (model[attribute] or '') .. '</textarea>')

        return tconcat(t,' ')
 end