<% '============================================================= '// '// Form Component '// '// version: 1.1 '// last modified: 19-Aug-2004 13:47 by Sasha Vukovic '============================================================= %> <% '------------- GLOBALS -------------- Const LIMG_FORM_COMPONENT_DROP_DOWN = "" Const LIMG_FORM_COMPONENT_DROP_DOWN_OFF = "" '------------------------------------ %> <% Class FormComponent Private mFormName Private mMethod Private mAction Private mOnSubmit Private msDisabled Public Property Let FormName ( sFormName ) mFormName = sFormName End Property Public Property Let Method ( sMethod ) mMethod = sMethod End Property Public Property Let Action ( sAction ) mAction = sAction End Property Public Property Let OnSubmit ( sOnSubmit ) mOnSubmit = "onSubmit='"& sOnSubmit &"'" End Property Public Property Let IsReadonlyAction ( IsReadonly ) If IsReadonly = enumDB_YES Then msDisabled = " disabled " ElseIf IsReadonly = enumDB_NO Then msDisabled = NULL Else msDisabled = " disabled " End If End Property '----------------------------------------------------------------------------------------------------------------- Public Function Combo ( sName, aList, bOneBlank, sAttributes ) '=== List Definition === ' Method expects list array to have 3 columns ( filed value, field name, word "selected" for selected item ) Dim compSTR Dim rowNum, numOfRows compSTR = "" '/* Generate Combo */ compSTR = compSTR &"" Combo = compSTR End Function '----------------------------------------------------------------------------------------------------------------- ' Combo_Multi ' Multi column combo ' - Uses a fixed length font to allow alignment of columns ' Column widths are specified ' Columns are separated by a "|" ' ' sName - Name of Combo ' aList - List array with the following columns: ' column key, column values (separated by comas), the word "selected" for selected item ' e.g ' 1, Jack, Smith, "W.A" ' 2, Jill, Smith, "S.A", "selected" ' bOneBlank - to add a blank combo item ' sAttributes - HTML attributes ' iColumnCount - The number of columns to be displayed in the combo. ' sColumnWidth - csv string containing the combo column widths ' Public Function Combo_Multi ( sName, aList, bOneBlank, sAttributes, iColumnCount, sColumnWidth) '=== List Definition === Dim compSTR Dim rowNum, numOfRows, colNum Dim sColVals, sColVal, sPad Dim iColLen, iPadLen, iValLen, i Dim arrColWidths compSTR = "" '/* Generate Combo */ compSTR = compSTR &"" Combo_Multi = compSTR End Function '----------------------------------------------------------------------------------------------------------------- Private Function Advanced_Combo ( sName, sValue, aList, sAttributes, sMore, bForceDropdown ) Dim compSTR Dim rowNum, numOfRows, Display compSTR = "" '--- Text Box --- compSTR = compSTR &"" '--- Dropdown Button --- If IsNull(aList) OR (NOT IsNull(msDisabled)) Then compSTR = compSTR & LIMG_FORM_COMPONENT_DROP_DOWN_OFF Advanced_Combo = compSTR Exit Function End If compSTR = compSTR &""& LIMG_FORM_COMPONENT_DROP_DOWN &"" '-- Default dispaly value Display = "none" If bForceDropdown Then Display = "block" End If '--- Dropdown List --- compSTR = compSTR &"
" compSTR = compSTR &"" compSTR = compSTR &"" compSTR = compSTR &" " compSTR = compSTR &"" compSTR = compSTR &"
" numOfRows = UBound( aList, 2 ) For rowNum = 0 To numOfRows compSTR = compSTR &" " compSTR = compSTR &" " compSTR = compSTR &" " Next '-- Display More.. link if required If NOT IsNull(sMore) Then compSTR = compSTR &" " compSTR = compSTR &" " compSTR = compSTR &" " End If compSTR = compSTR &"
"& aList(1, rowNum) &"
More...
" compSTR = compSTR &"
" Advanced_Combo = compSTR End Function '----------------------------------------------------------------------------------------------------------------- Public Function ComboWithTextAndFilter ( sName, sValue, aList, sAttributes, sMore, bForceDropdown ) ComboWithTextAndFilter = Advanced_Combo ( sName, sValue, aList, sAttributes, sMore, bForceDropdown ) End Function '----------------------------------------------------------------------------------------------------------------- Public Function ComboWithText ( sName, sValue, aList, sAttributes ) ComboWithText = Advanced_Combo ( sName, sValue, aList, sAttributes, NULL, FALSE ) End Function '----------------------------------------------------------------------------------------------------------------- Public Function TextArea ( sName, sValue, nRows, nCols, sAttributes ) TextArea = _ "" End Function '----------------------------------------------------------------------------------------------------------------- Public Function TextBox ( sName, sValue, sAttributes ) TextBox = _ "" End Function '----------------------------------------------------------------------------------------------------------------- Public Function SubmitButton ( sValue, sAttributes ) SubmitButton = _ "" End Function '----------------------------------------------------------------------------------------------------------------- Public Function CancelButton ( sValue, sAttributes, sURLreturn ) CancelButton = _ "" End Function '----------------------------------------------------------------------------------------------------------------- Public Function BackButton ( sValue, sAttributes ) BackButton = _ "" End Function '----------------------------------------------------------------------------------------------------------------- Public Sub FormStart () If IsNull(mFormName) Then Err.Raise 8, "Method FormComponent.FormStart", "Form Name is not defined." If IsNull(mAction) Then Err.Raise 8, "Method FormComponent.FormStart", "Action Filename is not defined." Response.write "
" End Sub '----------------------------------------------------------------------------------------------------------------- Public Sub FormEnd () Response.write "
" End Sub '----------------------------------------------------------------------------------------------------------------- Private Sub Class_Initialize() '// Perform action on creation of object. e.g. Set myObj = New ThisClassName mFormName = NULL mMethod = "post" mAction = NULL mOnSubmit = NULL msDisabled = NULL End Sub '----------------------------------------------------------------------------------------------------------------- Private Sub Class_Terminate() '// Perform action on object disposal. e.g. Set myObj = Nothing End Sub '----------------------------------------------------------------------------------------------------------------- End Class %>