By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

Passing hidden form elements using Java Script....

P: 2
Hi all,
I want to pass the value of the select box to another form using java script. my code looks like this..
<script>
function func
{
document.myform.action = "abc.cgi";
document.myform.submit();
}

<select name="xyz" onchange=func()>
<option value = "abc">1</option>
<<option value = "def">2</option>
</select>

I want to pass abc to next form (abc.cgi) when 1 is selected from the select box.
Please help me
Jun 29 '07 #1
Share this Question
Share on Google+
7 Replies


P: 2
Hi all,
I want to pass the value of the select box to another form using java script. my code looks like this..
<script>
function func
{
doucment.formname.action = "adc.cgi";
document.formname.submit();
}
<select name="xyz" onchange=func()>
<option value = "abc">1</option>
<<option value = "def">2</option>
</select>
I want to pass the value abc when 1 is selected to another form....

Please help me.....
Jun 29 '07 #2

acoder
Expert Mod 15k+
P: 16,027
func should have parentheses:
Expand|Select|Wrap|Line Numbers
  1. function func()
Jun 30 '07 #3

acoder
Expert Mod 15k+
P: 16,027
Threads merged.
Jun 30 '07 #4

kovik
Expert 100+
P: 1,044
And you may wanna clean up the dozens of syntax errors as well. :-p
Jul 1 '07 #5

gits
Expert Mod 5K+
P: 5,390
And you may wanna clean up the dozens of syntax errors as well. :-p
as far as i can see there are 'only' two more (besides the missing func-brackets) ;)

Expand|Select|Wrap|Line Numbers
  1. // put function call in quotes
  2. <select name="xyz" onchange="func();">
  3.  
  4. // fix opening tag
  5. <option value = "def">2</option>
  6.  
kind regards ...
Jul 1 '07 #6

kovik
Expert 100+
P: 1,044
as far as i can see there are 'only' two more (besides the missing func-brackets) ;)
And the missing <script> tag.
Jul 1 '07 #7

gits
Expert Mod 5K+
P: 5,390
;) i supposed this to be due to the snippet-pasting ... and assumed that it is not missing in the real app ...

kind regards ...
Jul 1 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.