Loading ...
Sorry, an error occurred while loading the content.
 

Re: [JavaScript] Select Option List Problem

Expand Messages
  • soren.j.winslow@cummins.com
    If I stared the options at 1 instead of 0, then my first option was blank and it still showed the next option. So, I went ahead and also added:
    Message 1 of 4 , Nov 13, 2008
      If I stared the options at 1 instead of 0, then my first option was blank
      and it still showed the next option. So, I went ahead and also added:
      TheForm.ReportPageOptions.options[4].selected = true;
      and that solved the problem. I guess the code needed an extra kick in the
      head to work right.

      Soren





      Tim Sabin <tim@...>
      Sent by: JavaScript_Official@yahoogroups.com
      11/13/2008 01:15 PM
      Please respond to
      JavaScript_Official@yahoogroups.com


      To
      JavaScript_Official@yahoogroups.com
      cc

      Subject
      Re: [JavaScript] Select Option List Problem






      Sounds to me like an array index problem. What happens if, instead of
      starting at options[0], you start at options[1]?

      --Tim Sabin


      > I have a server side script that writes my javascript for a select
      > options. The problem I am having is that the option that I tell it
      to
      > set as the selected option is not showing as the selected option. On
      > teh screen it shows the option above it. It doesnt make any sense to
      > me at all.
      >
      > For example...
      >
      > TheForm.ReportPageOptions.options[0] = new Option
      > ("Anchorage","Anchorage", false, false);
      > TheForm.ReportPageOptions.options[1] = new Option("Bob Bruner","Bob
      > Bruner", false, false);
      > TheForm.ReportPageOptions.options[2] = new Option("Brant
      > Smith","Brant Smith", false, false);
      > TheForm.ReportPageOptions.options[3] = new Option("Chris
      > Wahlberg","Chris Wahlberg", false, false);
      > TheForm.ReportPageOptions.options[4] = new Option("Greg
      > Reichert","Greg Reichert", true, true);
      > TheForm.ReportPageOptions.options[5] = new Option("Harry
      > Whittaker","Harry Whittaker", false, false);
      >
      > My script is selecting the right option, but on the screen it shows
      > Chris Wahlberg as being selected instead of Greg Reichert. I dont
      get
      > it.
      >
      > Soren
      >
      >




      [Non-text portions of this message have been removed]
    • PapaTango
      Are you using Firefox? It remembers form values that you ve had previously when you refresh the page so you don t see the default values being set. PT
      Message 2 of 4 , Nov 13, 2008
        Are you using Firefox? It 'remembers' form values that you've had
        previously when you refresh the page so you don't see the default values
        being set.

        PT

        Soren wrote:
        > I have a server side script that writes my javascript for a select
        > options. The problem I am having is that the option that I tell it to
        > set as the selected option is not showing as the selected option. On
        > teh screen it shows the option above it. It doesnt make any sense to
        > me at all.
        >
        > For example...
        >
        > TheForm.ReportPageOptions.options[0] = new Option
        > ("Anchorage","Anchorage", false, false);
        > TheForm.ReportPageOptions.options[1] = new Option("Bob Bruner","Bob
        > Bruner", false, false);
        > TheForm.ReportPageOptions.options[2] = new Option("Brant
        > Smith","Brant Smith", false, false);
        > TheForm.ReportPageOptions.options[3] = new Option("Chris
        > Wahlberg","Chris Wahlberg", false, false);
        > TheForm.ReportPageOptions.options[4] = new Option("Greg
        > Reichert","Greg Reichert", true, true);
        > TheForm.ReportPageOptions.options[5] = new Option("Harry
        > Whittaker","Harry Whittaker", false, false);
        >
        > My script is selecting the right option, but on the screen it shows
        > Chris Wahlberg as being selected instead of Greg Reichert. I dont get
        > it.
        >
        > Soren
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.