Add to Favorites    Make Home Page 2496 Online  
 Language Categories  
 Our Services  

Home » ASP Home » HTML Formatting Home » ASP Form Maker

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title ASP Form Maker
Description Creates an HTML form given an ADO recordset. Uses different controls (textbox, checkbox, textarea) for different datatypes. Determines maxlength property based on datatype. Keeps some useful info in hidden fields.
Category ASP » HTML Formatting
Hits 364428
Code Select and Copy the Code
.moreTblTags .moreCaptionTags .moreCellTags .moreRowTags Other: .uniqueField - defaults To 0. change If needed. .print(rs) - prints one record from the recordset. ' ' Returns:uses response.write to output ' nicely formatted HTML (with tabs and lin ' efeeds). ' ' Assumes:Tested on all JET/ADO datatype ' s. Extensive SQL server testing coming s ' oon. Should work though. There are some hidden fields With no value that you can update With JS If you like (example 'selected field'). You should use cascading style sheets To format the form. NS & IE Event management In Next version. ' ' Side Effects:Writes query string to a ' hidden field if you don't use a view. Does Not correctly determine maxlength For numeric types (except short Int, And Byte). ' <% 'TO DO: ' cross-browser event handling (caption ' onclick, field on change) 'shouldn't use HTML tags for formatting, ' use CSS 'verify with all SQL Server types. 'add 'goto hyperlink' and 'sendmail' ico ' ns if field contains (only) a url 'fix maxlength. shows number of bits for ' numbers. ' end to do Class CRecordEdit Public moreTblTags Public moreRowTags Public moreCaptionTags Public moreCellTags Private m_iPKFld Public Property Let uniqueField(ByVal p) m_iPKFld=uniqueField End Property Private Sub class_initialize() m_iPKFld=0 End Sub Public Sub Print(ByRef rs) With response .write "<TABLE" .write " " & moreTblTags .write ">" & vbCr Dim fld For Each fld In rs.fields .write vbTab & "<TR" .write " " & moreRowTags .write ">" .write "<TH" Select Case fld.type Case 3,17,2,131,5,6,4,130,129,202,200,72,7,135,203,201 .write " onClick=""" & fld.name & ".focus();""" Case 11 : .write " onClick=""" & fld.name & ".checked=!" & fld.name & ".checked;""" 'boolean End Select .write " " & moreCaptionTags .write ">" .write fld.name .write "</TH>" .write "<TD" ' .write " " & moreCellTags .write ">" Call showControl(fld) .write "</TD>" .write "</TR>" & vbCr Next .write "</TABLE>" .write vbCr & "<INPUT type=""hidden"" name=""query"" value=""" & rs.source & """>" .write vbCr & "<INPUT type=""hidden"" name=""dateAccessed"" value=""" & Now() & """>" .write vbCr & "<INPUT type=""hidden"" name=""uniqueField"" value=""" & rs.fields(m_iPKFld).name & """>" .write vbCr & "<INPUT type=""hidden"" name=""changedFields"" value="""">" .write vbCr & "<INPUT type=""hidden"" name=""selectedField"" value="""">" .write vbCr & "<INPUT type=""hidden"" name=""selectedValue"" value="""">" End With End Sub Private Sub showControl(ByRef fld) Dim name,val,maxLength,width,ftype name=fld.name val=fld.value maxLength=fld.definedSize width="" ftype=fld.type 'took out widths, use CSS Select Case ftype Case 7,135 'dates maxLength=22 ' width=21 Case 3,4,5,6 maxLength=99 'should figure this out actually Case 2 'adSmallInt (-32,000) maxLength=7 ' width=7 Case 72 'GUID maxLength=38 ' width=43 Case 17 'byte maxlength=3 ' width=3 End Select Select Case ftype Case 3,17,2,131,5,6,4,130,129,202,200,72,7,135 'regular text With response .write "<INPUT" .write " type=""text""" .write " name=""" & name & """" .write " value=""" & val & """" If Len(maxLength)>0 Then .write " maxlength=""" & maxLength & """" ' if len(width)>0 then .write " s ' ize=""" & width & """" .write " onFocus=""this.select();""" .write " " & moreCellTags .write ">" End With Case 203,201 'memo With response .write "<TEXTAREA" .write " name=""" & name & """" .write " rows=""4""" .write " cols=""40""" .write " onFocus=""this.select();""" .write " " & moreCellTags .write ">" .write val .write "</TEXTAREA>" End With Case 11 'boolean With response .write "<INPUT" .write " type=""checkBox""" .write " name=""" & name & """" .write " value=""true""" If val Then .write " checked " .write moreCellTags .write ">" End With Case Else Response.Write "<Binary>" End Select With response .write vbCr & vbTab & "<INPUT type=""hidden"" name=""" & name & "UNDERLYING"" value=""" & val & """>" .write vbCr & vbTab & "<INPUT type=""hidden"" name=""" & name & "ADOTYPE"" value=""" & ftype & """>" End With End Sub End Class %>

Related Source Codes

Script Name Author
ııııııııııııııııııııı VyomWorld
Resistor color code reader A.Chermarajan.
Telephone Directory dhivya
card swapping game (Mini Project) nityanand
simple hangman-pascalsource Seabert
college dirtectory (Mini Project) msridhar
Poll Application John van Meter
ASP Daily Hit Counter. Tejaskumar Gandhi
To avoid null in asp environment using sql Sami
Maklumbalas webmaster
poll John van Meter
EasyASP Template Engine. TjoekBezoer
Basic Calculator using HTML & Javascript. Patrick M. D Souza
What servers support ASP ? VyomWorld
What is ASP? VyomWorld

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=312


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review