Data Access Worldwide Knowledge Base
Article ID 2299 Article Title HOWTO: Make an HTML INPUT control "dynamically" readonly Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2299 KBase Category VDF12 Date Created 03/14/2007 Last Edit Date 03/22/2007
Article Text
QUESTION:
I have an ASP file that contructs my input controls. Based on a certain condition in the record I want the INPUT control readonly/disabled or a normal input control. How do I do this?
ANSWER:
When a dynamic generated INPUT control is constructed (with - for example - the "<%=oCustomer.DDValue("Customer.Credit_Limit",DDFORM)%>" ASP instruction) the function DDHndValue (of the cWebBusinessProcess class) is executed. When the passed argument is DDFORM the function DDFormControl is called. This function can be augmented (at object level) to return the correct HTML code. For example you could do:
Define C_READONLY For 'readonly="readonly"'
Define C_DISABLED For 'disabled="disabled"'
Function DDFormControl Handle hMain Integer iFile Integer iField String sParams Returns String
Integer iValueField iSpacePos
String sData
Forward Get DDFormControl hMain iFile iField sParams To sData
Get_FieldNumber Service.Value To iValueField
If (iField = iValueField And Service.Type <> "ABC") Begin
Move (Pos (" ", sData)) To iSpacePos
If (iSpacePos > 0) Begin
Move (Insert (' ' + C_READONLY * C_DISABLED, sData, iSpacePos)) To sData
End
End
Function_Return sData
End_Function
NOTE: When the type passed is not DDFORM but DDEDIT or another constant you need a different function than DDFormControl.
Contributed By:
Vincent Oorsprong
Company: Data Access Worldwide
email: vincent.oorsprong@dataaccess.eu
Web Site: http://www.dataaccess.eu
Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.
The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.