Jump to content

Form sending variables to the URL?


manuelV

Recommended Posts

Hi, I wanna start out by saying that I know very limited and that I did not come up with this code (Although I edited it to fit what I needed)

 

the code basically, what it does is the person picks one out of four radio buttons, and depending on which button they choose, a dropdown menu will show different values.

 

But when I hit the "Send" button, all the variables and values of the Inputs inside the form are sent into the URL.

 

How come it's doing this? Is there a way to stop this from happening, in such a way that it just sends you to the other page like it's supposed to?

 

This is the code

 

<script language="javascript">
window.document.getElementById("noOptions").style.display = "block";
window.document.getElementById("allOptions").style.display = "none";
function changeOptions() {
    var form = window.document.getElementById("form");
    var north = window.document.getElementById("north");
    var south = window.document.getElementById("south");
    var metis = window.document.getElementById("metis");
    var general = window.document.getElementById("general");

    window.document.getElementById("noOptions").style.display = "none";

    if (form.radioButton1.checked) {
        south.style.display = "none";
        general.style.display = "none";
metis.style.display = "none";
        north.style.display = "block";
        north.selectedIndex = 0;
    }
        else if (form.radioButton2.checked) {
        north.style.display = "none";
        general.style.display = "none";
metis.style.display = "none";
        south.style.display = "block";
        south.selectedIndex = 0;
    }
        else if (form.radioButton3.checked) {
        north.style.display = "none";
        general.style.display = "none";
south.style.display = "none";
        metis.style.display = "block";
        metis.selectedIndex = 0;
    } 
        else if (form.radioButton4.checked) {
        north.style.display = "none";
        metis.style.display = "none";
south.style.display = "none";
        general.style.display = "block";
        general.selectedIndex = 0;
    }

}
window.document.getElementById("radioButton1").onclick = changeOptions;
window.document.getElementById("radioButton2").onclick = changeOptions;
window.document.getElementById("radioButton3").onclick = changeOptions;
window.document.getElementById("radioButton4").onclick = changeOptions;
</script>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.