HighDots Forums  

select tag

alt.html alt.html


Discuss select tag in the alt.html forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
shikha810@gmail.com
 
Posts: n/a

Default select tag - 07-05-2006 , 09:02 AM






Hello,
I need to fix the horizontal display length for my list box. if there
is no element in it the display shrinks. i want to avoid this.

thanks
shikha


Reply With Quote
  #2  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: select tag - 07-05-2006 , 09:42 AM






shikha810 (AT) gmail (DOT) com <shikha810 (AT) gmail (DOT) com> scripsit:

Quote:
I need to fix the horizontal display length for my list box.
The real problem is probably something completely different. Why do you
think that you need to fix the horizontal display length for my list box?

Quote:
if there is no element in it the display shrinks.
If there is no element inside a select element, the document is in error -
it is a syntax error not to have any <option> inside a <select>, and quite
pointless too.

Quote:
i want to avoid this.
Write a meaningful select element. Post the URL and explain what you really
wish to accomplish, if problems remain.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #3  
Old   
shikha810@gmail.com
 
Posts: n/a

Default Re: select tag - 07-05-2006 , 10:20 AM



data in select is coming from a query and its possible that there are
no records in the selection.
this is strange that you are finding it difficult to imagine such a
scenario.
anyways, my problem is solved.
thanks


Reply With Quote
  #4  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: select tag - 07-05-2006 , 10:37 AM



shikha810 (AT) gmail (DOT) com <shikha810 (AT) gmail (DOT) com> scripsit:

Quote:
data in select is coming from a query and its possible that there are
no records in the selection.
It is normal Usenet conduct to quote or paraphrase the message you are
commenting on and to type normal mixed-case text with correct punctuation.
You are free to deviate from this if you don't care about getting useful
replies.

Quote:
this is strange that you are finding it difficult to imagine such a
scenario.
You have no idea of what I can or cannot imagine. What I wrote was that I
cannot know what your real problem is; apparently you don't either.

An empty <select> element is still a syntax error, no matter how it has been
generated.

Quote:
anyways, my problem is solved.
You probably think you have solved what seemed to you to be your problem.
The real problem remains, but apparently you were not interested.

Quote:
thanks
You're welcome.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #5  
Old   
Benjamin Niemann
 
Posts: n/a

Default Re: select tag - 07-05-2006 , 10:43 AM



shikha810 (AT) gmail (DOT) com wrote:

Quote:
data in select is coming from a query and its possible that there are
no records in the selection.
The purpose of a SELECT element is - as the name suggests - to select an
option. If there are no options, the SELECT element is pointless and just
confusing. And as Yukka pointed out, it is not allowed in HTML.

Quote:
this is strange that you are finding it difficult to imagine such a
scenario.
The scenario isn't difficult to imagine. But it is strange, if you don't
think that there is something wrong with the 'solution' of an empty SELECT
element.

Quote:
anyways, my problem is solved.
I hope by omitting the SELECT completely, if there are not options to choose
from.

P.S.: Please quote the relevant parts of the message you are replying to.

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/


Reply With Quote
  #6  
Old   
Jonathan N. Little
 
Posts: n/a

Default Re: select tag - 07-05-2006 , 12:39 PM



shikha810 (AT) gmail (DOT) com wrote:
Quote:
data in select is coming from a query and its possible that there are
no records in the selection.
this is strange that you are finding it difficult to imagine such a
scenario.
Then if no records are found generate a message "No Records Found" in
place of the SELECT element in your script.

Quote:
anyways, my problem is solved.
Can only imagine...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


Reply With Quote
  #7  
Old   
shikha810@gmail.com
 
Posts: n/a

Default Re: select tag - 07-06-2006 , 06:24 AM



what i wanted was the width attribute of select tag. using this one can
fix the horizontal display size of a list box.


Reply With Quote
  #8  
Old   
Jonathan N. Little
 
Posts: n/a

Default Re: select tag - 07-06-2006 , 08:48 AM



shikha810 (AT) gmail (DOT) com wrote:
Quote:
what i wanted was the width attribute of select tag. using this one can
fix the horizontal display size of a list box.

Two things. One, you did not quote, tsk-tsk. Two, you missed everyone's
point, a SELECT element with *no* OPTIONS is invalid and makes no sense.
If that situation occurs you should not create the SELECT but instead
some indication that no options exist...

SELECT element are supposed to adjust their widths to accommodate the
length of the OPTION within. You can constrain with the 'width' property
in CSS, but what you will you do with the overflow?

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


Reply With Quote
  #9  
Old   
Jonathan N. Little
 
Posts: n/a

Default Re: select tag - 07-07-2006 , 09:34 AM



Toby Inkster wrote:
Quote:
Jonathan N. Little wrote:

Two things. One, you did not quote, tsk-tsk. Two, you missed everyone's
point, a SELECT element with *no* OPTIONS is invalid and makes no sense.
If that situation occurs you should not create the SELECT but instead
some indication that no options exist...

My favourite way of doing this (in PHP) is:
One slight modification I would make, although a value between the
OPTION tags should become the value default value for the OPTION element
if there is no VALUE attribute, IE will not parse it when you try to
access the value via JavaScript, so I would explicitly set the VALUE
attribute

Quote:
?php

$started = FALSE;
while ($data = pg_fetch_array($results))
{
if (!$started)
{
print "<select blah blah blah>\n";
$started = TRUE;
}
//printf("\t<option>%s</option>\n", htmlentities($data['option']));
$v = htmlentities($data['option']);
printf("\t<option value=\"%s\">%s</option>\n", $v, $v);


Quote:
}
if ($started)
print "</select>\n";

unset($started);

?


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


Reply With Quote
  #10  
Old   
Rik
 
Posts: n/a

Default Re: select tag - 07-08-2006 , 06:15 AM



Quote:
$v = htmlentities($data['option']);
printf("\t<option value=\"%s\">%s</option>\n", $v, $v);
==
printf("\t<option value=\"%1$s\">%1$s</option>\n",
htmlentities($data['option']));

Grtz,
--
Rik Wasmus




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.