My form is like the above

<form method="post" name="publishResult" onsubmit="return g(this);">
    <select  id="options1" name="se1"  >
    		<option value="0" >-- Grade --</option>
                <option value="A+">A+</option>
                <option value="A">A</option>
                <option value="A-">A-</option>
                <option value="B+">B+</option>
                <option value="B">B</option>
                <option value="B-">B-</option>
                <option value="D">D</option>
                <option value="F">F</option>
      </select>
       <select  id="options2" name="se2"  >
    		<option value="0" >-- Grade --</option>
                <option value="A+">A+</option>
                <option value="A">A</option>
                <option value="A-">A-</option>
                <option value="B+">B+</option>
                <option value="B">B</option>
                <option value="B-">B-</option>
                <option value="D">D</option>
                <option value="F">F</option>
      </select>
        <select  id="options3" name="se3"  >
    		<option value="0" >-- Grade --</option>
                <option value="A+">A+</option>
                <option value="A">A</option>
                <option value="A-">A-</option>
                <option value="B+">B+</option>
                <option value="B">B</option>
                <option value="B-">B-</option>
                <option value="D">D</option>
                <option value="F">F</option>
      </select>

 <input type="submit" name="submit_result" />
</form>

onsubmit="return g(this);" here i want to get all the selected value of the 3dropdown list...Can any-one help me???

Recommended Answers

Are you wanting to pass all the values to the function or have all the values returned from the function?

Jump to Post

All 4 Replies

Are you wanting to pass all the values to the function or have all the values returned from the function?

Are you wanting to pass all the values to the function or have all the values returned from the function?

I want to pass all the values to the function so that i can pass these values through AJAX

Can you use getElementById in the function? Or, use it to pass to the function?

If you form submit is calling a function, then in that function you can get each value:

function formSubmit() {
  opt1val = document.getElementById('options1').value;
  opt2val = document.getElementById('options2').value;
  opt3val = document.getElementById('options3').value;

  // do something with those values
}

Would that work?

Can you use getElementById in the function? Or, use it to pass to the function?

If you form submit is calling a function, then in that function you can get each value:

function formSubmit() {
  opt1val = document.getElementById('options1').value;
  opt2val = document.getElementById('options2').value;
  opt3val = document.getElementById('options3').value;

  // do something with those values
}

Would that work?

thnxxx man it workde...:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.