• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 279
  • Last Modified:

Auto Select UnSelected Items on Form Submitt


I would like to default un-selected options to No XYZ on form submit.

Is this hard to do with Javascript? If not, how would you do it - simplest way possible.
1 Solution
John EastonDirectorCommented:
Hi Stroudtx,

I assume you do not want the default to be the 'none' option.  Therefore I would add a function which checks to see if the value of each select is less than 0 (i.e. not selected an option) and if so change it to the desire option.  Something like the below should work (although my JavaScript is not great so please check the syntax).

if (document.getElementById('option1').value < 0) {
document.getElementById('option1').value = "0|"

Hope this helps

stroudtxAuthor Commented:
Thanks - I"ll give it a try

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now