Combo box code is Working in IE perfectly but it is not working in FireFox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #16
    Post your code. Remember you have to use null for the second argument as I posted earlier.

    Comment

    • buss123
      New Member
      • May 2007
      • 29

      #17
      Originally posted by acoder
      Post your code. Remember you have to use null for the second argument as I posted earlier.

      here i am posting my code this also working in IE but not in FF my code follows


      [CODE=javascript]function displayComboVal ues(comboName,c omboValue){
      if(document.for mmain(comboName ).type=='select-one'){
      var optn = document.create Element("OPTION ");
      optn.text = comboValue;
      optn.value = comboValue;
      try{
      document.formma in(comboName).o ptions.add(optn ,null);
      }
      catch(ex){
      document.formma in(comboName).o ptions.add(optn );
      }
      document.formma in(comboName).o ptions[document.formma in(comboName).l ength-1].selected=true;
      }else{
      document.formma in(comboName).v alue=comboValue ;
      }
      }[/CODE]
      Last edited by gits; Oct 24 '07, 09:23 AM. Reason: added code tags

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #18
        Instead of [CODE=javascript]if(document.for mmain(comboName ).type=='select-one'){[/CODE] try: [CODE=javascript]if(document.for mmain[comboName].name=='select-one'){[/CODE] Surely, you mean the name, not the type.

        Perhaps you could post your form HTML as well as how you are calling this function.

        Comment

        • buss123
          New Member
          • May 2007
          • 29

          #19
          Originally posted by acoder
          Instead of [CODE=javascript]if(document.for mmain(comboName ).type=='select-one'){[/CODE] try: [CODE=javascript]if(document.for mmain[comboName].name=='select-one'){[/CODE] Surely, you mean the name, not the type.

          Perhaps you could post your form HTML as well as how you are calling this function.


          hi ,
          even i change it if(document.for mmain(comboName ).name=='select-one'){ no use same thing happening . here i am sending code how i am declaering and calling combobox

          [HTML]<td width="40%" align="center" valign="center" >
          <select name="medDirect ion<%=i%>" style="font-family:Verdana; font-size: 8pt; color: #000000;border: 0px solid #666666 ; BORDER-WIDTH: 1px; BORDER-STYLE: inset; width:500px" class="subvalue " onKeyDown="fnKe yDownHandler(th is, event);" onKeyUp="fnKeyU pHandler_A(this , event); return false;" onKeyPress = "return fnKeyPressHandl er_A(this, event);" onChange="fnCha ngeHandler_A(th is, event);"
          value="<jsp:get Property name="_adminBea n" property="medDi rection"/>">
          <option value=""></option>
          <option value="AC">AC</option>
          <option value="BID">BID </option>
          <option value="GT">GT</option>
          <option value="HS">HS</option>
          <option value="OD">OD</option>
          </select>
          </td>[/HTML]


          for displaying these combo box values calling the method like this
          <Script>
          displayComboVal ues("medDirecti on0",'<%=_admin Bean.getMedDire ction()%>');
          </Script>

          pls tell me where is the problem

          Thanking u
          Last edited by gits; Oct 24 '07, 09:24 AM. Reason: added code tags

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #20
            What's "select-one"? The type of a combo box is going to be "select".

            Do you get any errors? If so, on what line?

            Comment

            • buss123
              New Member
              • May 2007
              • 29

              #21
              Originally posted by acoder
              What's "select-one"? The type of a combo box is going to be "select".

              Do you get any errors? If so, on what line?


              select-one is the combobox name . we didnt get any errors . combobox working fine but the values are not displaying in the FireFox .


              Thanking u

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #22
                The name of the combo box that you're passing is "MedDirecti on0"

                Comment

                • voxecho
                  New Member
                  • Nov 2005
                  • 7

                  #23
                  Ok, i know this comes a little late on the topic, but i had to comment on this.

                  build a select box (size=1 line)
                  give it some dummy options
                  now, add the following

                  onchange="alert (this.type)"

                  any guess what it will return? i will give you a hint, it's not "select"

                  it will return "select-one" and if it's a multiple select it will return... yes, you guessed it "select-multiple"

                  so checking on the o.type=="select-one" is perfectly valid;

                  just thought i would weigh in on that.


                  Originally posted by acoder
                  Instead of [CODE=javascript]if(document.for mmain(comboName ).type=='select-one'){[/CODE] try: [CODE=javascript]if(document.for mmain[comboName].name=='select-one'){[/CODE] Surely, you mean the name, not the type.

                  Perhaps you could post your form HTML as well as how you are calling this function.

                  Comment

                  • voxecho
                    New Member
                    • Nov 2005
                    • 7

                    #24
                    bus, did you ever solve this?

                    i wonder if the problem isn't the fact that you are addressing the element with the wrong indexing operator... actually i am surprised it's working in any broswer

                    rather then
                    Code:
                    document.formname[B]([/B]formelement[B])[/B].type==
                    try
                    Code:
                    document.formname[B][[/B]formElement[B]][/B].type==
                    note the [ rather then (


                    Originally posted by buss123
                    select-one is the combobox name . we didnt get any errors . combobox working fine but the values are not displaying in the FireFox .


                    Thanking u

                    Comment

                    • gits
                      Recognized Expert Moderator Expert
                      • May 2007
                      • 5388

                      #25
                      Originally posted by voxecho
                      Ok, i know this comes a little late on the topic, but i had to comment on this.

                      build a select box (size=1 line)
                      give it some dummy options
                      now, add the following

                      onchange="alert (this.type)"

                      any guess what it will return? i will give you a hint, it's not "select"

                      it will return "select-one" and if it's a multiple select it will return... yes, you guessed it "select-multiple"

                      so checking on the o.type=="select-one" is perfectly valid;

                      just thought i would weigh in on that.
                      ;) interesting hint i tested it and of course you're right ... i didn't know about that (and never needed it yet but good to know now) ... thank you for this ...

                      kind regards ...

                      Comment

                      • acoder
                        Recognized Expert MVP
                        • Nov 2006
                        • 16032

                        #26
                        Originally posted by voxecho
                        Ok, i know this comes a little late on the topic, but i had to comment on this.

                        build a select box (size=1 line)
                        give it some dummy options
                        now, add the following

                        onchange="alert (this.type)"

                        any guess what it will return? i will give you a hint, it's not "select"

                        it will return "select-one" and if it's a multiple select it will return... yes, you guessed it "select-multiple"

                        so checking on the o.type=="select-one" is perfectly valid;

                        just thought i would weigh in on that.
                        Interesting - I didn't know that. Thanks for pointing that out.

                        Incidentally, I found this - silly me for not checking.

                        Comment

                        • buss123
                          New Member
                          • May 2007
                          • 29

                          #27
                          compatible word for 'select-one' in Firefox

                          Hi all,
                          the following line of code is working fine in IE but the same line of code is not working in Firefox . can any one help me is there any other way to write the same line of code for firefox.

                          if(document.for mmain(comboName ).type=='select-one')

                          my main doubt is 'select-one' will work in firefox or not? if not pls tell me is there any alternative for that.

                          Comment

                          • acoder
                            Recognized Expert MVP
                            • Nov 2006
                            • 16032

                            #28
                            This reminds me of your earlier thread. Is it the same problem?

                            Comment

                            • buss123
                              New Member
                              • May 2007
                              • 29

                              #29
                              Originally posted by acoder
                              This reminds me of your earlier thread. Is it the same problem?


                              Yes after a long time again i shifteed to that problem again , what is the compatiable word to "select-one"

                              Comment

                              • Logician
                                New Member
                                • Feb 2007
                                • 210

                                #30
                                Originally posted by buss123
                                Yes after a long time again i shifteed to that problem again , what is the compatiable word to "select-one"
                                You still don't seem to understand, the problem has nothing to do with the type identifier.

                                The syntax
                                Code:
                                document.formmain(comboName)
                                is incorrect as it constitutes a function call not a reference. The Firefox error console must be indicating this.

                                Code:
                                if(document.formmain[B][[/B]comboName[B]][/B].type=='select-one')

                                Comment

                                Working...