Specify Width of drop down box (Full Version)

All Forums >> [Web Development] >> Microsoft FrontPage Help



Message


dzirkelb1 -> Specify Width of drop down box (2/15/2005 12:32:19)

How do I do it?

Here is my drop down box I wish to modify:

<select NAME="DistrictManager" SIZE="1">
<option></option>
<!--#include file="../../_fpclass/fpdbrgn1.inc"-->
<option><%=FP_FieldHTML(fp_rs,"DistrictManager")%></option>
<!--#include file="../../_fpclass/fpdbrgn2.inc"-->
</select>

I tried adding width="20" to the select statement but it wouldn't work...what is the correct html to change this? Thanks!




rdouglass -> RE: Specify Width of drop down box (2/15/2005 12:42:29)

I don't think you can; I think it's determined by the longest item in the list.

You may be able to "pad" your list; something like:

<option><%IF len(FP_Field(fp_rs,"DistrictManager")) < 20 THEN Response.write(FP_Field(fp_rs,"DistrictManager") & REPLICATE(" ",20-len(FP_Field(fp_rs,"DistrictManager")))) ELSE Response.write(FP_Field(fp_rs,"DistrictManager")) END IF%></option>

That any help?




dzirkelb1 -> RE: Specify Width of drop down box (2/15/2005 12:58:15)

That produces the following error:

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'REPLICATE'
/breaktime/clients/search.asp, line 491

Line 491 is Response.write("<option>" & F.Name & "</option>" & VbCrLf) which is in the middle of an array.




rdouglass -> RE: Specify Width of drop down box (2/15/2005 13:02:10)

quote:

Line 491 is Response.write("<option>" & F.Name & "</option>" & VbCrLf)


I don't see REPLICATE in that line. [&:] Can you post the code you're using?




dzirkelb1 -> RE: Specify Width of drop down box (2/15/2005 13:04:20)

Yup..doesn't make sense to me either :)

Here is the code:

<%
fp_sQry="SELECT DISTINCT DistrictManager FROM LocationData ORDER BY DistrictManager ASC"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="BreakTimeEnterData"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="DistrictManager"
fp_sMenuValue="DistrictManager"
fp_sColTypes="&DistrictManager=202&"
fp_iDisplayCols=1
fp_fCustomQuery=True
BOTID=2
fp_iRegion=BOTID
%>
<select NAME="DistrictManager" SIZE="1">
		<option></option>
		<!--#include file="../../_fpclass/fpdbrgn1.inc"-->
		<option><%IF len(FP_Field(fp_rs,"DistrictManager")) < 20 THEN Response.write(FP_Field(fp_rs,"DistrictManager") & REPLICATE(" ",20-len(FP_Field(fp_rs,"DistrictManager")))) ELSE Response.write(FP_Field(fp_rs,"DistrictManager")) END IF%></option> 

		<!--#include file="../../_fpclass/fpdbrgn2.inc"-->
		</select></nobr></td>
	</tr>
	<tr>
		<td colspan="5">
		<p align="center"><b>Sorting</b></td>
	</tr>
	<tr>
		<td><b><font size="2">Column</font></b></td>
		<td colspan="4">
<% 
DIM myDSN, myConn, mySQL, myTempRS, F 

mySQL = "SELECT * FROM qrySortColumn" 
myDSN = Application("BreakTimeEnterData_ConnectionString") 

Response.write("<select size='1' name='SortColumn'><option></option>" & VbCrLf) 

set myConn=server.createobject("adodb.connection") 
myConn.open myDSN 
set myTempRS=myConn.execute(mySQL) 

For Each F In myTempRS.Fields 
Response.write("<option>" & F.Name & "</option>" & VbCrLf) 
Next 

myTempRS.close 
Set myTempRS = nothing 
myConn.close 
Set myConn = nothing 

Response.write("</select>" & VbCrLf) 
%> 


That isnt' all of the code (too big) but that contains the option values and the array that the error came from.




rdouglass -> RE: Specify Width of drop down box (2/15/2005 13:06:45)

quote:

Response.write(FP_Field(fp_rs,"DistrictManager") & REPLICATE(" ",20-len(FP_Field(fp_rs,"DistrictManager"))))


Try using STRING instead of REPLICATE. REPLICATE is an SQL Server only function I think. Sorry if I misled you...

Response.write(FP_Field(fp_rs,"DistrictManager") & STRING(" ",20-len(FP_Field(fp_rs,"DistrictManager"))))




dzirkelb1 -> RE: Specify Width of drop down box (2/15/2005 13:15:13)

I get the following error:

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'FP_Field(...)'
/breaktime/clients/search.asp, line 491

Line 491 is: set myTempRS=myConn.execute(mySQL)


So I tried this:

<option><%DIM DistrictManager
DistrictManager=FP_FieldHTML(fp_rs,"DistrictManager")%>
<%IF len(DistrictManager) < 20 THEN Response.write(DistrictManager & STRING(" ",20-len(DistrictManager)))%>
<%ELSE Response.write(DistrictManager)%>
<% END IF%></option>

and get the following error:

Error Type:
Microsoft VBScript compilation (0x800A03FB)
Expected 'Loop'
/breaktime/clients/search.asp, line 494

line 494 is myConn.open myDSN




rdouglass -> RE: Specify Width of drop down box (2/15/2005 13:19:58)

quote:

IF len(DistrictManager) < 20 THEN


I give it one more quick shot before I load up your code.[;)]

IF (len(DistrictManager&"") < 20 THEN

If it's Null, let's force it to an empty string. That's what I'd try next anyways.




rdouglass -> RE: Specify Width of drop down box (2/15/2005 13:24:38)

quote:

For Each F In myTempRS.Fields
Response.write("<option>" & F.Name & "</option>" & VbCrLf)
Next


I think we're looking in the wrong place. Have you confirmed the query "SELECT * FROM qrySortColumn" returns any data?




dzirkelb1 -> RE: Specify Width of drop down box (2/15/2005 13:28:56)

no luck..here is the code I have:

<%DIM DistrictManager 
		DistrictManager=FP_FieldHTML(fp_rs,"DistrictManager")%> 
<option><%IF (len(DistrictManager&"")) < 20 THEN Response.write(DistrictManager & STRING(" ",20-len(DistrictManager)))%> 
		<%ELSE Response.write(DistrictManager)%> 
		<%END IF%>
</option>


It produces this error:

Error Type:
Microsoft VBScript compilation (0x800A03FB)
Expected 'Loop'
/breaktime/clients/search.asp, line 495

Line 495 is:

myConn.open myDSN




rdouglass -> RE: Specify Width of drop down box (2/15/2005 13:34:12)

quote:

<%
DIM myDSN, myConn, mySQL, myTempRS, F

mySQL = "SELECT * FROM qrySortColumn"
myDSN = Application("BreakTimeEnterData_ConnectionString")

Response.write("<select size='1' name='SortColumn'><option></option>" & VbCrLf)

set myConn=server.createobject("adodb.connection")
myConn.open myDSN
set myTempRS=myConn.execute(mySQL)

For Each F In myTempRS.Fields
Response.write("<option>" & F.Name & "</option>" & VbCrLf)
Next

myTempRS.close
Set myTempRS = nothing
myConn.close
Set myConn = nothing

Response.write("</select>" & VbCrLf)
%>


Try commenting out all that code to see if the error actually is in that loop or the DRW. I suspect the error is not in the DWR, but this will rule it out one way or another....




dzirkelb1 -> RE: Specify Width of drop down box (2/15/2005 13:38:16)

I deleted that code in its entirety and it gives the same error...line 494 this time is:

<input type="radio" name="ColumnFilter" value=" ASC">Ascending<br>




rdouglass -> RE: Specify Width of drop down box (2/15/2005 13:48:52)

quote:

<%DIM DistrictManager
DistrictManager=FP_FieldHTML(fp_rs,"DistrictManager")%>
<option><%IF (len(DistrictManager&"")) < 20 THEN Response.write(DistrictManager & STRING(" ",20-len(DistrictManager)))%>
<%ELSE Response.write(DistrictManager)%>
<%END IF%>
</option>


So if you make this section this :

<option><%=FP_FieldHTML(fp_rs,"DistrictManager")%></option>

does it now work? IOW is it really that section causing the prob?





dzirkelb1 -> RE: Specify Width of drop down box (2/15/2005 13:56:02)

Yup, if I change it back to its original of <option><%=FP_FieldHTML(fp_rs,"DistrictManager")%></option> , then it displays all the results...just, not the specified width i'd like it to be.




rdouglass -> RE: Specify Width of drop down box (2/15/2005 14:22:46)

Well I was able to padd the items with spaces doing this:

<!--#include file="_fpclass/fpdbrgn1.inc"-->
<option><%IF len(FP_Field(fp_rs,"UserName")) < 100 THEN Response.write(FP_Field(fp_rs,"UserName") & STRING(100-len(FP_Field(fp_rs,"UserName"))," ")) ELSE Response.write(FP_Field(fp_rs,"UserName")) END IF%></option>
<!--#include file="_fpclass/fpdbrgn2.inc"-->

I have no idea why your's doesn't; it seems as tho it should.

with a DRW I put together. However, my browser seems to "trim" those entries so the dropdown doesn't expand. [:'(]

My only other suggestion would be to put a "dummy" entry at the top or bottom with something like:

<option>Please Select One --</option>

(I think there was 20 characters there.) Even if i put a char at the end of my padding, the browser removed all but one between any characters when displaying.[:(]

Sorry I wasn't much help.





dzirkelb1 -> RE: Specify Width of drop down box (2/15/2005 14:32:47)

Ahh, a dummy saying at the top...that would work pretty well for what I wish to accomplish. I find it wierd that this can't be done simply and it is so complicated to get it to to work...buy, hey, I didn't write the language :)

Thanks for you ideas rdouglass..i'll put the dummy ones in and it will look great :)




dzirkelb1 -> RE: Specify Width of drop down box (2/15/2005 14:36:22)

well, this works:

<option>          </option>

place as many of those bad boys as needed :)




Spooky -> RE: Specify Width of drop down box (2/15/2005 14:37:22)

Use a style to control the width [;)]

eg : <select style="width:100px">


eg : <select style="width:200px">




rdouglass -> RE: Specify Width of drop down box (2/15/2005 14:50:38)

When in doubt, ask Spooky![;)]




dzirkelb1 -> RE: Specify Width of drop down box (2/15/2005 15:12:52)

sweetness...that does it a lot easier than adding the " "...thanks!




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.09375