Hello friends,
Is there any way to get the value from a drop down list at the instant it is clicked and not
when the 'Submit' button is pressed ?
Thanks in advance...
drop down list
Moderator: General Moderators
Re: drop down list
Heh. Just realized I said "button". I meant "dropdown".
JavaScript. One way or another.
Add an onclick event to the button to submit the form. All it does is save the user the terrible task of moving the mouse an inch and slightly depressing one of the buttons.
JavaScript. One way or another.
Add an onclick event to the button to submit the form. All it does is save the user the terrible task of moving the mouse an inch and slightly depressing one of the buttons.
Last edited by requinix on Fri Oct 17, 2008 3:03 pm, edited 1 time in total.
-
littlecoder
- Forum Commoner
- Posts: 26
- Joined: Fri Oct 17, 2008 4:36 am
Re: drop down list
Hi ,
Yes, but that would only get the value in the javascript vode..
Is it possible to get that value into a php variable?
Yes, but that would only get the value in the javascript vode..
Is it possible to get that value into a php variable?
Re: drop down list
littlecoder wrote:Hi ,
Yes, but that would only get the value in the javascript vode..
Is it possible to get that value into a php variable?
Either the form gets submitted or you use something like AJAX.I wrote:JavaScript. One way or another.
Re: drop down list
Not true. You pass the var as as post or get.littlecoder wrote:Hi ,
Yes, but that would only get the value in the javascript vode..
Is it possible to get that value into a php variable?
$_GET[], $_POST[]
I use this:
<select onchange='this.$form_name.submit()'>
Re: drop down list
According to HTML DOM standards, every form element has a form property - the owning form element. So, I would rewrite your code as:papa wrote:I use this:
<select onchange='this.$form_name.submit()'>
Code: Select all
<select onchange='this.form.submit()'>There are 10 types of people in this world, those who understand binary and those who don't
Re: drop down list
Oops,
That's actually how I use it. Copied it wrong from my function.
...
$onSubmit = "onchange='this.form.submit()' ";
return "<select ".$onSubmit.$formSelect;
...
That's actually how I use it. Copied it wrong from my function.
...
$onSubmit = "onchange='this.form.submit()' ";
return "<select ".$onSubmit.$formSelect;
...
-
littlecoder
- Forum Commoner
- Posts: 26
- Joined: Fri Oct 17, 2008 4:36 am
Re: drop down list
Hi friends ,
Thank you...The 'this.form.submit()' worked...
saved me a lot of time...Thank you
Thank you...The 'this.form.submit()' worked...
saved me a lot of time...Thank you