Runtime Exception Occurs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • malav123
    New Member
    • Feb 2008
    • 217

    Runtime Exception Occurs

    Hi,
    I am using one Legend for one section of Filtering that contains one button also and i want to put some validation in that section on that button's click event but when i calls the javascript function on Button click event runtime Exception occurs, So where is the problem... The error i am getting is "run time exception Object Excepted "...
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    without posting the code related to that problem it would be guesswork for anybody to give you an answer ... so please post the related code ...

    kind regards

    Comment

    • malav123
      New Member
      • Feb 2008
      • 217

      #3
      Originally posted by gits
      without posting the code related to that problem it would be guesswork for anybody to give you an answer ... so please post the related code ...

      kind regards

      My code of javascript is given below,
      [code=javascript]
      function CheckFilterDate s(f)
      {

      if(!(f.ctl00_Co ntentPlaceHolde r1_txtsortFrom. text==""))
      {

      if(f.ctl00_Cont entPlaceHolder1 _txtsortTo.text =="")
      {
      alert("Please Enter The Value of Remaining Date");
      return false;
      }
      }

      if(!(f.ctl00_Co ntentPlaceHolde r1_txtsortTo.te xt==""))
      {
      if(f.ctl00_Cont entPlaceHolder1 _txtsortFrom.te xt=="")
      {
      alert("Please Enter The Value of Remaining Date");
      return false;
      }
      }
      }
      [/code]
      I have also used "getElementById " but it's still giving me same error...
      Last edited by gits; Apr 4 '08, 10:58 AM. Reason: fix code tags - please use [CODE=javascript] your code [/CODE]

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        do you have a formelement with:

        Code:
        name = "ctl00_ContentPlaceHolder1_txtsortFrom"
        in your case or:

        Code:
        id = "ctl00_ContentPlaceHolder1_txtsortFrom";
        when you use getElementById( );?

        kind regards

        Comment

        • malav123
          New Member
          • Feb 2008
          • 217

          #5
          Originally posted by gits
          do you have a formelement with:

          Code:
          name = "ctl00_ContentPlaceHolder1_txtsortFrom"
          in your case or:

          Code:
          id = "ctl00_ContentPlaceHolder1_txtsortFrom";
          when you use getElementById( );?

          kind regards


          Yes my formelement id is
          Code:
           id = "ctl00_ContentPlaceHolder1_txtsortFrom";
          and i am using f.id, instead of this i also tried the getElementById( ) but in the both case i am getting the same error....
          so where is the problem ??
          i am calling this function with button's onclick event...

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5390

            #6
            in case the id is correct, which you could check when having a look at the rendered page (just use view source in the browser) and search for your formelement with that id ... then:

            [CODE=javascript]var id = 'ctl00_ContentP laceHolder1_txt sortFrom';
            var n = document.getEle mentById(id);
            [/CODE]
            have to give you a reference to that node for variable n. could you please post the call of document.getEle mentById() and the rendered code for your node?

            kind regards

            Comment

            • malav123
              New Member
              • Feb 2008
              • 217

              #7
              Originally posted by gits
              in case the id is correct, which you could check when having a look at the rendered page (just use view source in the browser) and search for your formelement with that id ... then:

              [CODE=javascript]var id = 'ctl00_ContentP laceHolder1_txt sortFrom';
              var n = document.getEle mentById(id);
              [/CODE]
              have to give you a reference to that node for variable n. could you please post the call of document.getEle mentById() and the rendered code for your node?

              kind regards


              Ya it's true, but the same thing is working well with button outside of <fieldset> means the button which is outside the legend, the problem is not with the id because if i callls simple blank function without body then also it giving me same error.... means if i calls
              [CODE=javascript]
              function CheckDate(f)
              {
              alert("Date");
              }
              [/CODE]

              then also it is giving me same error...
              so where is the problem ? please suggest me where is the problem ?

              Comment

              • gits
                Recognized Expert Moderator Expert
                • May 2007
                • 5390

                #8
                hmmmm ... is any other action triggered with the button click? do you have a testpage where i could have a look at? how are the event-handlers attached to the buttons?

                kind regards

                Comment

                • malav123
                  New Member
                  • Feb 2008
                  • 217

                  #9
                  Originally posted by gits
                  hmmmm ... is any other action triggered with the button click? do you have a testpage where i could have a look at? how are the event-handlers attached to the buttons?

                  kind regards
                  No, Only one action is triggered with Button click.... that is
                  Code:
                   
                  btnFilter.Attributes.Add("Onclick", "return CheckFilterDates(this.form)")
                  and my button is within the fieldset,
                  Code:
                  <fieldset>
                  <legend>Filter</legend>
                  <asp:Button ID="btnFilter" runat="server" Text="Filter" />
                  </fieldset>
                  I am not getting from where this error occurs....

                  Comment

                  • gits
                    Recognized Expert Moderator Expert
                    • May 2007
                    • 5390

                    #10
                    are you sure that your parameter this.form is correct here?

                    Comment

                    • malav123
                      New Member
                      • Feb 2008
                      • 217

                      #11
                      Originally posted by gits
                      are you sure that your parameter this.form is correct here?

                      Yes i am using this.form with another button attributes and working proper.... i have also tried only this but still getting same error....

                      Comment

                      • gits
                        Recognized Expert Moderator Expert
                        • May 2007
                        • 5390

                        #12
                        what about using no param at all? does the problem persist in that case? ... could you try the application in FF and have a look at the error-console ... probably we get a much better error description with that ...

                        kind regards

                        Comment

                        • malav123
                          New Member
                          • Feb 2008
                          • 217

                          #13
                          Originally posted by gits
                          what about using no param at all? does the problem persist in that case? ... could you try the application in FF and have a look at the error-console ... probably we get a much better error description with that ...

                          kind regards
                          Yes i also tried the no param but still i getting the same error, FF i have not tried yet...

                          Comment

                          • gits
                            Recognized Expert Moderator Expert
                            • May 2007
                            • 5390

                            #14
                            have you tried it now? what does the console says? ...

                            kind regards

                            Comment

                            • malav123
                              New Member
                              • Feb 2008
                              • 217

                              #15
                              Originally posted by gits
                              have you tried it now? what does the console says? ...

                              kind regards

                              Yes it works well in FF, so now how to debug my problem in IE...? and this problem is only occurs with button which is within the legend...

                              Comment

                              Working...