-------------------------------------------------------------------------------- -- Title: LWForm.lua -- Description: Like a square peg in a round hole -- Author: Raphaël Szwarc http://alt.textdrive.com/lua/ -- Creation Date: February 1, 2005 -- Legal: Copyright (C) 2005 Raphaël Szwarc -------------------------------------------------------------------------------- -- import dependencies local LWComponent = require( "LWComponent" ) local LWStyle = require( "LWStyle" ) local LUList = require( "LUList" ) local LULocale = require( "LULocale" ) -- define the class local super = LWComponent local self = super() -- method to access this form action function self:action() return self:bindings():get( "action" ) or self:context():request():uri():path() end -- method to access this form charset function self:charset() return self:bindings():get( "charset" ) or self:context():response():encoding() end -- method to access this form encoding function self:encoding() return self:bindings():get( "encoding" ) or "multipart/form-data" end -- method to access this form method function self:method() return self:bindings():get( "method" ) or "POST" end -- method to access this form target function self:target() return self:bindings():get( "target" ) or "_self" end -- method to access this form content function self:content() local aValue = self:bindings():get( "content" ) return tostring( aValue ) end -- method for string representation function self:toString() local aBuffer = LUList() local aStyle = LWStyle:styleWithComponent( self ) aBuffer:add( "
" ) aBuffer:add( self:content() ) aBuffer:add( "
" ) return aBuffer:join( "" ) end return self