Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Please help to limit number of selections in multiple select list box

Reply
Thread Tools

Please help to limit number of selections in multiple select list box

 
 
Paul
Guest
Posts: n/a
 
      01-22-2004
Hi,

I'd like to limit the number of selections a user can make in a
multiple select listbox. I have a note on the interface to say that
only x no. of items should be selected and I check the number server
side but I'd like to implement some javascript to do the same on the
client side. Ideally I'd like the javascript to work in IE5+ and
Netscape6+.

Thanks,

Paul
 
Reply With Quote
 
 
 
 
Michael Winter
Guest
Posts: n/a
 
      01-22-2004
On 22 Jan 2004 09:39:20 -0800, Paul <(E-Mail Removed)> wrote:

> I'd like to limit the number of selections a user can make in a
> multiple select listbox. I have a note on the interface to say that
> only x no. of items should be selected and I check the number server
> side but I'd like to implement some javascript to do the same on the
> client side.


You'll need to provide some more information, namely, what should happen
when a user selects a extra option? Should the user simply be alerted?
Should some form of intelligent algorithm be applied to keep the number of
selections within the prescribed limits?

> Ideally I'd like the javascript to work in IE5+ and Netscape6+.


Unless this is an Intranet application, I would hope you want it to work
on my browser (Opera) and every other one in use, too. Move beyond the
outdated 'two browser' world.

Mike

--
Michael Winter
http://www.velocityreviews.com/forums/(E-Mail Removed)d (replace ".invalid" with ".uk" to reply)
 
Reply With Quote
 
 
 
 
kaeli
Guest
Posts: n/a
 
      01-22-2004
In article <(E-Mail Removed)>,
(E-Mail Removed)d enlightened us with...
>
> > Ideally I'd like the javascript to work in IE5+ and Netscape6+.

>
> Unless this is an Intranet application, I would hope you want it to work
> on my browser (Opera) and every other one in use, too. Move beyond the
> outdated 'two browser' world.
>


Don't forget Safari.
I hear it's getting very popular with Mac users...

I myself use Mozilla or Netscape 7, depending on which computer I'm on.

/glad I code for intranet apps these days

--
--
~kaeli~
A midget fortune teller who escapes from prison is a small
medium at large.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

 
Reply With Quote
 
Michael Winter
Guest
Posts: n/a
 
      01-22-2004
On Thu, 22 Jan 2004 12:24:40 -0600, kaeli <(E-Mail Removed)>
wrote:

> In article <(E-Mail Removed)>,
> (E-Mail Removed)d enlightened us with...
>>
>> > Ideally I'd like the javascript to work in IE5+ and Netscape6+.

>>
>> Unless this is an Intranet application, I would hope you want it to work
>> on my browser (Opera) and every other one in use, too. Move beyond the
>> outdated 'two browser' world.

>
> Don't forget Safari.


I didn't.

"...every other one in use, too."

> I hear it's getting very popular with Mac users...


Really? Wonder why...

> I myself use Mozilla or Netscape 7, depending on which computer I'm on.


I personally can't stand the interface. There's something about it that
just seems ugly to me. Other than that, their fine applications.

Mike

--
Michael Winter
(E-Mail Removed)d (replace ".invalid" with ".uk" to reply)
 
Reply With Quote
 
kaeli
Guest
Posts: n/a
 
      01-22-2004
In article <(E-Mail Removed)>,
(E-Mail Removed)d enlightened us with...
> On Thu, 22 Jan 2004 12:24:40 -0600, kaeli <(E-Mail Removed)>
> wrote:
>
> > In article <(E-Mail Removed)>,
> > (E-Mail Removed)d enlightened us with...
> >>
> >> > Ideally I'd like the javascript to work in IE5+ and Netscape6+.
> >>
> >> Unless this is an Intranet application, I would hope you want it to work
> >> on my browser (Opera) and every other one in use, too. Move beyond the
> >> outdated 'two browser' world.

> >
> > Don't forget Safari.

>
> I didn't.
>


Oh, I know, I was referring to the OP.

Sorry.

>
> > I myself use Mozilla or Netscape 7, depending on which computer I'm on.

>
> I personally can't stand the interface. There's something about it that
> just seems ugly to me. Other than that, their fine applications.


Oh, they ARE ugly.
I use themes, specifically a really pretty blue one called Sky Pilot
Classic.
I tried Opera a while back and tons of sites didn't work with it (it had
crappy CSS and DHTML support), but I loved the tabbed browsing and lack
of popups. So, I got into Mozilla and liked it a lot. I haven't tried
Opera again, but I think it's gotten way better since I last tried it,
around V5.
At work, only IE and NN are available. So, I use NN7 here.

--
--
~kaeli~
A man needs a mistress... just to break the monogamy.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

 
Reply With Quote
 
Michael Winter
Guest
Posts: n/a
 
      01-22-2004
On Thu, 22 Jan 2004 13:46:28 -0600, kaeli <(E-Mail Removed)>
wrote:

> In article <(E-Mail Removed)>,
> (E-Mail Removed)d enlightened us with...
>
>> I personally can't stand the interface. There's something about it that
>> just seems ugly to me. Other than that, their fine applications.

^^^^^
D'oh. That, of course, should have been "they're".

> Oh, they ARE ugly.
> I use themes, specifically a really pretty blue one called Sky Pilot
> Classic.


Glad I'm not the only one with that opinion. I'll be giving Mozilla
another go once I re-install Linux. I didn't know you could skin it
(didn't keep it around long enough to find out).

> I tried Opera a while back and tons of sites didn't work with it (it had
> crappy CSS and DHTML support), but I loved the tabbed browsing and lack
> of popups. So, I got into Mozilla and liked it a lot. I haven't tried
> Opera again, but I think it's gotten way better since I last tried it,
> around V5.


Opera's support for virtually everything is pretty good now. There are
some sites that break with it though, but that's more than likely the
short-sightedness of the web developer, not the browser[1].

There are some things that need improving, such as XHTML support (scripts
don't work in XHTML mode), but the list of items not implemented is quite
small[2]. Certainly, everything in common use has been supported. If you
want to take a look at the list, the address is
http://www.opera.com/docs/specs/

Mike


[1] I usually have problems with these same sites using IE 5.5, so draw
your own conclusions.
[2] OK, it's not exactly 'small', but the bits missing are rather
insignificant.

--
Michael Winter
(E-Mail Removed)d (replace ".invalid" with ".uk" to reply)
 
Reply With Quote
 
kaeli
Guest
Posts: n/a
 
      01-22-2004
In article <(E-Mail Removed)>,
(E-Mail Removed)d enlightened us with...
>
> > Oh, they ARE ugly.
> > I use themes, specifically a really pretty blue one called Sky Pilot
> > Classic.

>
> Glad I'm not the only one with that opinion. I'll be giving Mozilla
> another go once I re-install Linux. I didn't know you could skin it
> (didn't keep it around long enough to find out).
>


Well, there's not a whole hell of a lot out there, but there's a decent
number over at the Mozilla site.

Note for any NN users reading this - I just got NN7. I tried to skin it
with the stuff from NN's site and got errors because all their links
still point to NN6 and NN7 won't use the themes from NN6. Go over to
Mozilla's theme site instead of Netscape's theme park and you won't have
that problem.
http://themes.mozdev.org/

>
> Opera's support for virtually everything is pretty good now. There are
> some sites that break with it though, but that's more than likely the
> short-sightedness of the web developer, not the browser[1].
>


Good to know.
My main problem with it was a lack of .style support even though it
supported getElementById. Almost no one checks for .style - they assume
if a browser supports getElementById, it supports both. Also, there are
way too many sites that still use browser detection instead of object
detection, so they try to do IE-only things with Opera if I have it set
to spoof IE, but do nothing if I leave it as Opera.
Do you have that problem with the new version?

--
--
~kaeli~
With her marriage, she got a new name and a dress.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      01-22-2004
"Michael Winter" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
<snip>
>... (scripts don't work in XHTML mode), ...

<snip>

That isn't strictly true. Opera 7 doesn't recognise script elements but
it does recognise and execute intrinsic events. With a bit of work you
can get quite a lot of code into an event handling attribute string (I
think it is something like 64Kb).

Combining the code in the onclick attributes of 4 <input type="button">
elements (which I had to click in the correct order to properly
initialise the script) I was able to get one of my DOM scanning scripts
running on an XHTML page[1] in Opera 7, allowing me to verify that they
have implemented more of the HTML DOM in their XHTML DOM implementation
than Mozilla has.

Richard.

[1] A valid XHTML page served as application/xhtml+xml rather than
text/html (which results in a normal HTML DOM).


 
Reply With Quote
 
Lasse Reichstein Nielsen
Guest
Posts: n/a
 
      01-22-2004
kaeli <(E-Mail Removed)> writes:

{Opera support of stuff]
> My main problem with it was a lack of .style support even though it
> supported getElementById. Almost no one checks for .style - they assume
> if a browser supports getElementById, it supports both.


What version of Opera was that? Or are you referring to Opera 6's limited
DHTML capability (can't change display property etc.)? Because I can see
style properties back to Opera 4 at least (document.body.style exists).

Opera 7's CSS 2 support is almost perfect (on the same level as
Mozilla's - only minor details are not absolutely correct).

> Also, there are way too many sites that still use browser detection
> instead of object detection, so they try to do IE-only things with
> Opera if I have it set to spoof IE, but do nothing if I leave it as
> Opera. Do you have that problem with the new version?


They are rare, and usually say something like "We only support IE v4
and Netscape v4 or better, click here to upgrade your browser" (which
I mentally translate to "I am a clueless moron, please kick me").
That is, they are easily identifiable.

/L
--
Lasse Reichstein Nielsen - (E-Mail Removed)
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
 
Reply With Quote
 
Michael Winter
Guest
Posts: n/a
 
      01-22-2004
On Thu, 22 Jan 2004 14:21:43 -0600, kaeli <(E-Mail Removed)>
wrote:

> In article <(E-Mail Removed)>,
> (E-Mail Removed)d enlightened us with...
>>
>> Opera's support for virtually everything is pretty good now. There are
>> some sites that break with it though, but that's more than likely the
>> short-sightedness of the web developer, not the browser[1].

>
> Good to know.
> My main problem with it was a lack of .style support even though it
> supported getElementById. Almost no one checks for .style - they assume
> if a browser supports getElementById, it supports both. Also, there are
> way too many sites that still use browser detection instead of object
> detection, so they try to do IE-only things with Opera if I have it set
> to spoof IE, but do nothing if I leave it as Opera.
> Do you have that problem with the new version?


I never spoof as IE and I've only had two sites that flat-out refuse to
work:

1) Mr. Morgenstern's ISKEET site (posted to this group - now been fixed)
2) A site recommended by Netscape for DOM tutorials,
http://www.getelementbyid.com/ [1]

As for .style, Opera seems to support it quite nicely. Of course, if it
didn't, I'm not likely to notice but a few sites have performed dynamic
background colour changes on mouse movement, and the like.

Mike


[1] Obviously, if a site states, "Sorry, this site is optimized for
Internet Explorer 5 and Netscape 6!!!" and it is supposed to teach how to
script sites, it's not very good, and not worth my time. We'll see what
Netscape thinks of such a practice: I asked them to remove the site from
their list.

--
Michael Winter
(E-Mail Removed)d (replace ".invalid" with ".uk" to reply)
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LoadPostData and html <select> with multiple selections studen771 ASP .Net Building Controls 0 09-22-2006 05:34 PM
Multiple list boxes and controlling selections sleon@cbbcorp.com Javascript 1 01-27-2005 04:11 PM
Manage FORM SELECT with multiple selections Stian HTML 2 09-03-2004 12:42 AM
How can I separate FORM SELECT with multiple selections? Stian ASP General 2 09-02-2004 11:59 AM
select of select box will select multiple in another box palmiere Javascript 1 02-09-2004 01:11 PM



Advertisments