/    Sign up×
Community /Pin to ProfileBookmark

Problem with a form

[QUOTE]

<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>

[/QUOTE]

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”

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@SeGamysaMar 26.2003 — document.FormName.SelectName.value

or if ur looking for the indexed value its

document.FormName.SelectName.selectedIndex

is that what u wanted?
Copy linkTweet thisAlerts:
@CornauthorMar 26.2003 — 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>
[/QUOTE]


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..
Copy linkTweet thisAlerts:
@CornauthorMar 26.2003 — 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>[/QUOTE]


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..
Copy linkTweet thisAlerts:
@SeGamysaMar 26.2003 — 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.
×

Success!

Help @Corn spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...