Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quick Question on TextBoxs <input Type="text">

Status
Not open for further replies.

guestAsh

Technical User
Feb 27, 2004
65
GB
Hi hope someone can help me out here, if I leave out the property "MAXlength" in the input tag for textboxes how many Characters will it accept?

cheers

Ash
 
I just tried on a text box on my site. With 1989 characters it wouldn't submit. With 1988 it would.



Tony
[red]_________________________________________________________________[/red]
Webmaster -
 
nothing happened at all - was wierd. No error displayed just no action taken when pressing the submit button. As soon as I removed a character from the textbox it would submit fine.


Tony
[red]_________________________________________________________________[/red]
Webmaster -
 
Ok thanks Tony,

Slightly more character than I was anticipated. I was hoping it would be in the region of 250, and that would explain why I'm getting errors when I use some VB script to download answers in a text box to an Excel spreadsheet.

Cheers

Ash
 
Neither, a bit of a long storey, but to cut a long story short, I have a ASP page that has Text box with diferent types of data in it, baiscally 32 text boxs across the page, with around about 1800 rows. once the page loads it runs some script to transfere that data into a spread sheet but every now and and again it falls over usually because (i think, and this is what im trying to work out!) theres maybe a text box that holds a lot of text in it usually 250 charaters and spaces.

Any way i'll think i'll try the ASP forum, see anyone can spread some light!

thanks
 
Cory, 1024 characters is the limit for QueryStrings (pretty sure anyway)

guestAsh,
Can you post your code please?

Tony
[red]_________________________________________________________________[/red]
Webmaster -
 
Sure, ok A quick explanation on what's going on here, the page gets its data from a database, depending on some small calculations, it works out how many textboxes per line and how many rows, the script then basically takes that and transfers it to excel. here you....


Code:
<!--#include virtual="/GPPObuilding/includes/Dev_top_nohead.asp"-->
<!--#include virtual="/gps/includes/adovbs.inc"-->

<html>
<head>
</head>
<script LANGUAGE="VBScript">
sub cmdxl_onclick()
	'Launch Excel
	Dim TheForm, oValue, oName, nObjs, oDisp
	Dim s, xcol, xrow, formaddr, xstart
	Dim wb, app, n, Qu, headQU, nSub
	
	'start Row = 4
	xstart = 4

	set TheForm = document.forms("xlout")
	set app = createobject("Excel.Application")
    headQU = TheForm.item("numberQuest").value ' should be 15
	nSub = TheForm.item("RowCount").value/headQU ' should be 2
	' Make it visible
	app.Visible = true
	    
	' Add a new workbook
	set wb = app.workbooks.add
	    
	' Fill array of values first...
	nObjs = TheForm.length ' not used, but this is how you get the number of objects on a form

	' Titles Layout as per Border Graphics Spreadsheet
	app.StatusBar = "Please wait... adding headings"
	wb.Activesheet.Cells(1, 1).Value = "Online survey Builder"
	wb.Activesheet.Cells(1, 1).Font.size = "16"
	wb.Activesheet.Cells(1, 1).Font.Bold = True
	
	wb.Activesheet.Cells(2, 3).Value = date()
	wb.Activesheet.Cells(2, 3).Font.size = "12"
	wb.Activesheet.Cells(2, 3).Font.Bold = True

	
	wb.Activesheet.Cells(2, 2).Value = "Extract Date:"
	wb.Activesheet.Cells(2, 2).Font.size = "12"
	wb.Activesheet.Cells(2, 2).Font.Bold = True
	
	'Headings for spreadsheet   
	'wb.Activesheet.Cells(xstart, 1).Value = "Prop Ref"
		
	'For xcol = 0 to 44 ' cols
	'	formaddr = Trim(Cstr(0)) & "," & Trim(Cstr(xcol))
	'	wb.Activesheet.Cells(xrow+xstart, xcol+1).Value = "'" & trim(left(TheForm.item(formaddr).value,250))
	'next
	
	app.StatusBar = "Please wait... formatting headings"
	
	For i = 0 To headQU 
		
		wb.Activesheet.Cells(xstart,i + 1).Interior.ColorIndex = 3
		wb.Activesheet.Cells(xstart,i + 1).Font.Bold = True
		wb.Activesheet.Cells(xstart,i + 1).Font.size = 8
		wb.Activesheet.Cells(xstart,i + 1).ColumnWidth = 15
		wb.Activesheet.Cells(xstart,i + 1).RowHeight = 10
		wb.Activesheet.Cells(xstart,i + 1).VerticalAlignment = 1
		wb.Activesheet.Cells(xstart,i + 1).WrapText = True
		wb.Activesheet.Cells(xstart,i + 1).Borders(3).Weight = 2
		wb.Activesheet.Cells(xstart,i + 1).Borders(4).Weight = 2
		wb.Activesheet.Cells(xstart,i + 1).Borders(1).Weight = 2
		wb.Activesheet.Cells(xstart,i + 1).Borders(2).Weight = 2
	next 
	qu =0 ' sets the question number
	'get data
	app.StatusBar = "Please wait... fetching data"
	
	' question header

		For xcol= 1 to headQU ' COLS
		qu=qu+1
		wb.Activesheet.Cells(xstart, xcol).Value = "'" & qu
	
		 next
		 
		For xrow = 1 to nSub ' ROWS 2
		For xcol = 1 to headQU ' COLS
		formaddr = Trim(Cstr(xcol)) & "," & Trim(Cstr(xrow))
				
		wb.Activesheet.Cells(xrow+xstart+1, xcol).Value = "'" & trim(left(TheForm.item(formaddr).value,250))
		   
		next
	next




	'formatting
	app.StatusBar = "Please wait... formatting data"
	Dim strRange
	
	strRange = "T5:T" & TheForm.item("RowCount").value + xstart
	wb.Activesheet.Range(strRange).NumberFormat = "#,##0.00"
	
	strRange = "A" & xstart + 1 & ":AS" & TheForm.item("RowCount").value + xstart
	wb.Activesheet.Range(strRange).WrapText = false
	wb.Activesheet.Range(strRange).MergeCells = false
	wb.Activesheet.Range(strRange).HorizontalAlignment = 1
	wb.Activesheet.Range(strRange).VerticalAlignment = 1
	wb.Activesheet.Range(strRange).Font.Bold = False
	wb.Activesheet.Range(strRange).Font.size = 8
	wb.Activesheet.Range(strRange).Rows.AutoFit
    
    strRange = "A" & xstart & ":AS" & TheForm.item("RowCount").value + xstart
    wb.Activesheet.Range(strRange).Columns.AutoFit
    	
	
	' Give the user control of Excel
	app.UserControl = true

	app.StatusBar = "Job Done"
	msgbox "Transfer to Excel completed.",vbinformation,"Online survey Builder"
	end sub
</script>

<body onload="cmdxl_onclick();">

<form name="xlout">
<% 
	'on error resume next
	Dim objRec
	Dim objRec1
	Dim objRec2
	Dim SQLcount
	Dim SQLQuery
	Dim StrText
	Dim I
	Dim iRow
	Dim curprop
	
	'Set ObjRec = Server.CreateObject("ADODB.Recordset")
	Response.write "<TABLE border=0 width='100%'>"

		'FM's
		Response.Write "<TR>"
		Response.Write "<TD width=175><Font face='arial' size='2'></TD>"
		
		
		if Request.QueryString("sid")<>"" or Request.QueryString("qid")<>""	then			
		Response.Write "<hr>"
			'create report
			
	Set objRec = Server.CreateObject("ADODB.Recordset")
	SQLQuery = "SELECT GPS.TBLRESULTS.ANSWER"
	SQLQuery = SQLQuery & " FROM GPS.TBLRESULTS"
	SQLQuery = SQLQuery & " WHERE GPS.TBLRESULTS.QUESTCODE ='" &  Request.querystring("qid")  & "'"
	SQLQuery = SQLQuery & " And GPS.TBLRESULTS.SURVEY_ID ='" &  Request.querystring("sid")  & "'"
	SQLQuery = SQLQuery & " ORDER BY SUBMIT_ID, SUB_DATE, IP, QUESTION_NO"
	'Response.Write  SQLQuery
	objRec.open SQLQuery, conn, adOpenForwardOnly, adLockReadOnly 
	Set objRec1 = Server.CreateObject("ADODB.Recordset")						
	SQLcount = "SELECT Count(RESULTS_ID) AS reccount FROM GPS.TBLRESULTS"		
	SQLcount = SQLcount & " WHERE GPS.TBLRESULTS.QUESTCODE ='" &  Request.querystring("qid")  & "'"
	SQLcount = SQLcount & " And GPS.TBLRESULTS.SURVEY_ID ='" &  Request.querystring("sid")  & "'"
	SQLcount = SQLcount & " ORDER BY SUBMIT_ID, SUB_DATE, IP, QUESTION_NO"		
	objRec1.open SQLcount, conn, adOpenForwardOnly, adLockReadOnly 
			
	Set objRec2 = Server.CreateObject("ADODB.Recordset")	
	
	SQLQuery = "SELECT GPS.TBLSETUP.NUMBEROFQUEST"
	SQLQuery = SQLQuery & " FROM GPS.TBLSETUP"
	SQLQuery = SQLQuery & " WHERE GPS.TBLSETUP.QUESTCODE ='" &  Request.querystring("qid")  & "'"
	SQLQuery = SQLQuery & " And GPS.TBLSETUP.SURVEY_ID ='" &  Request.querystring("sid")  & "'"
		
	objRec2.open SQLQuery, conn, adOpenForwardOnly, adLockReadOnly 				
	
					
			
			%>
			<!--<input type="Button" Value="View in Excel" Name="btnxl" onclick="cmdxl_onclick();">-->
			<p>Please wait exporting data to Excel.......</p>
			<table cellpadding="0" cellspacing="0" border="0">
			<tr>
			<%
			iRow=0
			'for I = 0 to ObjRec.Fields.count - 1
			'Response.Write "<td>" & Replace(ObjRec.fields(I).Name,"_"," ") & "<INPUT type='hidden' name='" & irow & "," & i & "' value='" & Replace(ObjRec.fields(I).Name,"_"," ") & "'</TD>"
			'next%>
			</tr>

			<%
			Dim iSubmit
			dim Col
 			iSubmit = objRec2("NUMBEROFQUEST")
			iRow = 0
			col =1
			Response.Write "<TR>"
			If Not objRec.EOF Then
			
			
				Do Until objRec.EOF
				
					iRow = iRow + 1
			if iRow = iSubmit+1 then
			col =col+1
			irow =irow - iSubmit 
			Response.Write "</TR><TR>"
					End if
					For i = 0 To objRec.fields.Count-1
					
						Response.Write "<TD><font face=arial size=1>"
						Response.Write "<INPUT name='" & irow & "," & col & "' value='" & ObjRec.fields(I).value & "'>"			
						Response.Write "</TD>"
					
					Next
			
				objRec.MoveNext
		
				
			Loop
				Response.Write "</TR>"
			End If
					
			
			%><input id="RowCount" type="hidden" name="RowCount" value="<%=objRec1("reccount")%>"> <!-- use SQL count to get value-->
			<input id="numberQuest" type="hidden" name="numberQuest" value="<%=objRec2("NUMBEROFQUEST")%>"><!-- get from tblesetup-->
			
			
			</table><% 
			objRec.Close
		set	objRec = nothing
			objRec1.Close
		set	objRec1 = nothing
			objRec2.Close
		set	objRec2 = nothing
		End if 
		%><a href="javascript:window.close();">Close Window</a>
</form>
<!--#include virtual="/GPPObuilding/includes/bottom.asp"-->





        <p><!--webbot bot="PurpleText" PREVIEW="DO_NOT_REMOVE_END" --></p>
      
<p><small>Last
        updated: <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d/%m/%y" startspan -->17/03/05<!--webbot bot="Timestamp" endspan i-checksum="12907" --></small></td>
        <td width="29%" valign="top" class="rightcolumn">
             

</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top