Click to See Complete Forum and Search --> : Problem with a form
<form action=javascript:void(0); method=get onSubmit=Stem(XXX);>
<select name="stemme">
<option value="1">Ja</option>
<option value="2">Nei</option>
</select><br>
<input type="Submit" value="TStem" align="MIDDLE">
</form>
This is my form. I have a javscript called Stem, that needs either value 1 or value 2 which has been entered by a reader..
After the reader has voted, what is the command for what he has voted? something like "stemme.value"
SeGamysa
03-26-2003, 08:35 AM
document.FormName.SelectName.value
or if ur looking for the indexed value its
document.FormName.SelectName.selectedIndex
is that what u wanted?
Thanks, I think that is what i wanted ;)
But still, this code doesn't open a new window, with http://xxx/vote.php?VALUE
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<SCRIPT LANGUAGE="JavaScript">
<!--
function SiDinMening( answer ) {
answerValue = 0;
if (answer != null) { for (cnt = 0; cnt < answer.length; cnt++) { if (answer[cnt].checked == true) {answerValue = answer[cnt].value; break;} } }
if ( answerValue == 0 ) {answerValue = '';}
siDinMeningWindow = window.open('http://XXX.com/vote.php?do=' + answerValue, 'Avstemming', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width= 420,height=500');
}
//-->
</SCRIPT>
<body>
<form action=javascript:void(0);
method=get
name=sidinmeningform
onSubmit=SiDinMening(document.sidinmeningform.kaaring.value);>
<select name=kaaring>_ _
<option value=rle>Ja</option>
<option value=yah>Nei</option>
_ _ </select><br>
_ _ <input type="Submit" value="Stem" align="MIDDLE">
</form>
</body>
</html>
Don't mind the script, I know it works.
I want this form, to pop up a window when somebody has voted. That windows should be something like: www.mypage.com/vote.php?THEVOTE
If i change the "document.sidinmeningform.kaaring.value" to for example "document.sidinmeningform.answer" it will pop up in a new window, without THEVOTE.
Now it doesn't pop up at all..
Or perhaps the script doesn't work.
It is made for a form with radio buttons, not dropdown list. Maybe thats it?
EDIT:
Oops, I thought i was finished, but...
This thing works BUT:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script language="JavaScript">
<!--
function winopens(doo)
{
window.open('http://mypage.com/vote.php?do=' + doo);
}
//-->
</script>
<body>
<form>
<select name="test" onChange="winopens(value);">
<option>choose
<option value="ja">test.html
<option value="nei">myother.html
</select>
<br><input type=Submit value=Vote>
</form>
</body>
</html>
This thing works, but only with "onChange"
All i need to do, is to change the onChange to onSubmit... Cuz I want the window to pop up after someone has pushed Vote.
But I have a feeling that onChange can't be brutally replace by onSubmit..
SeGamysa
03-26-2003, 11:16 AM
well next time u might also warn us that ur site is a tad provocative.
when i fixed ur code all that stuff came up lucky for me know one saw
Well it was also my fault for using ur links.