select fields - instant population!!

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
silent assassin
Forum Newbie
Posts: 13
Joined: Mon Feb 27, 2006 6:53 pm

select fields - instant population!!

Post by silent assassin »

Hey guys, I don't know if this is possible or not, but I want my users to be able to select a month (Jan, Feb, etc, etc...) and the correct amount of dates populate into a select field next to it.

An example of what I'm looking to do can be found here http://www.nvidia.com/content/drivers/drivers.asp

Basically, I want a field to populate from data in a field on the same page. Is this possible without submitting the actual form? I know its possible in asp, but php? I dunno, I've just started to dig around in it. Tips, tricks, suggestions, all are appreciated. Thanks in advance guys!!
User avatar
ed209
Forum Contributor
Posts: 153
Joined: Thu May 12, 2005 5:06 am
Location: UK

Post by ed209 »

Isn't it done with javascript?

maybe this post might help you out:

viewtopic.php?t=45198&highlight=ajax
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

yeah, it's javascript.. and it doesn't require ajax. :P

hint: new Date()
silent assassin
Forum Newbie
Posts: 13
Joined: Mon Feb 27, 2006 6:53 pm

Post by silent assassin »

feyd wrote:yeah, it's javascript.. and it doesn't require ajax. :P

hint: new Date()
Explain please? I'm really needing help on this and I haven't been able to find anything else. Also, I don't know much about javascript period, so I'm somewhat in the dark. Any examples, suggestions, anything?\

Thanks again
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The Date object has the power to tell lots of information about dates and times..

http://devguru.com/technologies/javascript/10585.asp
silent assassin
Forum Newbie
Posts: 13
Joined: Mon Feb 27, 2006 6:53 pm

Post by silent assassin »

hmmm....i'm not sure you guys are getting what im asking. I understand about the date object. My problem is, how do i make the second field populate without submitting a form or reloading the page? The links I presented before
http://www.nvidia.com/content/drivers/drivers.asp doesnt' seem to reload the page or anything. I know I can get the maxdays in a month using date(), but how do i make it 1)see whichi month I'm selecting without submitting/reloading the page and 2) get that data without submitting/reloading the page?
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

sorry, off topic, but...

my old roommate's nickname was silent assassin, so your name made me chuckle. :D
silent assassin
Forum Newbie
Posts: 13
Joined: Mon Feb 27, 2006 6:53 pm

Post by silent assassin »

The Ninja Space Goat wrote:sorry, off topic, but...

my old roommate's nickname was silent assassin, so your name made me chuckle. :D

Your name isnt...Shawn....by any chance....is it?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

use the onchange event of the <select> you can get the value via the options array (a property of the object)
silent assassin
Forum Newbie
Posts: 13
Joined: Mon Feb 27, 2006 6:53 pm

Post by silent assassin »

feyd wrote:use the onchange event of the <select> you can get the value via the options array (a property of the object)

Sorry to sound like a completely clueless fool, but what? You're talking about the value for the individual options, right? Ok, so...how? Its my understanding that onchange triggers a javascript event, correct? How to do that in javascript?

Another quickie, is it possible for the onchange to trigger a php function that will populate the information instead?
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Post by matthijs »

Take a look at this article at devshed in which an inventory system is build which uses the functionality you describe ( if I understand you well). Make the first selection of a dropdown, and the second one is filled with the relevant choices ffor that first selection.
Post Reply