Page 1 of 1

select fields - instant population!!

Posted: Tue Mar 14, 2006 12:26 pm
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!!

Posted: Tue Mar 14, 2006 12:49 pm
by ed209
Isn't it done with javascript?

maybe this post might help you out:

viewtopic.php?t=45198&highlight=ajax

Posted: Tue Mar 14, 2006 3:14 pm
by feyd
yeah, it's javascript.. and it doesn't require ajax. :P

hint: new Date()

Posted: Wed Mar 15, 2006 12:08 pm
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

Posted: Wed Mar 15, 2006 12:33 pm
by feyd
The Date object has the power to tell lots of information about dates and times..

http://devguru.com/technologies/javascript/10585.asp

Posted: Wed Mar 15, 2006 12:45 pm
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?

Posted: Wed Mar 15, 2006 12:50 pm
by Luke
sorry, off topic, but...

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

Posted: Wed Mar 15, 2006 12:53 pm
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?

Posted: Wed Mar 15, 2006 1:15 pm
by feyd
use the onchange event of the <select> you can get the value via the options array (a property of the object)

Posted: Fri Mar 17, 2006 1:58 pm
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?

Posted: Fri Mar 17, 2006 2:29 pm
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.