why wont my function 'EnableValidators' fire?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dufus

    why wont my function 'EnableValidators' fire?

    <a id="MyDataList_ _ctl1_edit_Butt on" NAME="edit_Butt on"
    OnMousedown="En ableValidators( 'editGroup_');" href="javascrip t:{if
    (typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
    __doPostBack('M yDataList$_ctl1 $edit_Button',' ')} ">Edit</a>

    In the above example, the function 'EnableValidato rs' does not fire. Has it
    got something to do with the fact the id and name attributes are different?
    I am unable to make the id and name attributes the same so is there anything
    I can do to get it to work?

    Thanks in advance.


  • Lee

    #2
    Re: why wont my function 'EnableValidato rs' fire?

    Dufus said:[color=blue]
    >
    ><a id="MyDataList_ _ctl1_edit_Butt on" NAME="edit_Butt on"
    >OnMousedown="E nableValidators ('editGroup_'); " href="javascrip t:{if
    >(typeof(Page_C lientValidate) != 'function' || Page_ClientVali date())
    >__doPostBack(' MyDataList$_ctl 1$edit_Button', '')} ">Edit</a>
    >
    >In the above example, the function 'EnableValidato rs' does not fire. Has it
    >got something to do with the fact the id and name attributes are different?
    >I am unable to make the id and name attributes the same so is there anything
    >I can do to get it to work?[/color]

    What makes you think that EnableValidator s() isn't being called?
    Maybe that function isn't working.

    Comment

    • Dufus

      #3
      Re: why wont my function 'EnableValidato rs' fire?


      "Lee" <REM0VElbspamtr ap@cox.net> wrote in message
      news:cnort002h9 6@drn.newsguy.c om...[color=blue]
      > Dufus said:[color=green]
      >>
      >><a id="MyDataList_ _ctl1_edit_Butt on" NAME="edit_Butt on"
      >>OnMousedown=" EnableValidator s('editGroup_') ;" href="javascrip t:{if
      >>(typeof(Page_ ClientValidate) != 'function' || Page_ClientVali date())
      >>__doPostBack( 'MyDataList$_ct l1$edit_Button' ,'')} ">Edit</a>
      >>
      >>In the above example, the function 'EnableValidato rs' does not fire. Has
      >>it
      >>got something to do with the fact the id and name attributes are
      >>different?
      >>I am unable to make the id and name attributes the same so is there
      >>anything
      >>I can do to get it to work?[/color]
      >
      > What makes you think that EnableValidator s() isn't being called?
      > Maybe that function isn't working.
      >[/color]

      it works because I have stripped it down to just an alert box and have
      successfully called it from elsewhere.


      Comment

      • RobG

        #4
        Re: why wont my function 'EnableValidato rs' fire?

        Dufus wrote:[color=blue]
        > <a id="MyDataList_ _ctl1_edit_Butt on" NAME="edit_Butt on"
        > OnMousedown="En ableValidators( 'editGroup_');" href="javascrip t:{if
        > (typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
        > __doPostBack('M yDataList$_ctl1 $edit_Button',' ')} ">Edit</a>
        >
        > In the above example, the function 'EnableValidato rs' does not fire. Has it
        > got something to do with the fact the id and name attributes are different?
        > I am unable to make the id and name attributes the same so is there anything
        > I can do to get it to work?[/color]

        From the HTML spec at W3C.org:

        "The id and name attributes share the same name space. This means that
        they cannot both define an anchor with the same name in the same
        document. It is permissible to use both attributes to specify an
        element's unique identifier for the following elements: A, APPLET,
        FORM, FRAME, IFRAME, IMG, and MAP. *When both attributes are used on a
        single element, their values must be identical.*" (my emphasis).

        <URL: http://www.w3.org/TR/html4/struct/links.html#h-12.2.3>

        As for the rest of your element...

        Not sure what you are trying to achieve. If your intention is for
        EnableValidator s to run onmousedown, then for the script attached to
        the href to execute, it does not work in all browsers. Safari (and
        maybe others) will not run the script on the href if another function
        fires (onclick, onmousedown, etc.).

        The usual idea is to have the href go to a useful page for those with
        JavaScript disabled, then have the onmousedown end with

        return false;

        which stops the browser from following the href link if javascript is
        enabled.

        Then add the script you have on the href to the end of the onmousedown:

        <a id="MyDataList_ _ctl1_edit_Butt on" NAME="edit_Butt on"
        href="aUsefulPa ge.html"
        OnMousedown="
        EnableValidator s('editGroup_') ;
        if (typeof(Page_Cl ientValidate) != 'function' ||
        Page_ClientVali date())
        __doPostBack('M yDataList$_ctl1 $edit_Button',' ');
        return false;
        ">Edit</a>

        The above is utterly untested 'cos I have no idea what all your
        functions are, however the syntax should be correct.

        Rob.

        Comment

        • Fred Oz

          #5
          Re: why wont my function 'EnableValidato rs' fire?

          Dufus wrote:[color=blue]
          > <a id="MyDataList_ _ctl1_edit_Butt on" NAME="edit_Butt on"
          > OnMousedown="En ableValidators( 'editGroup_');" href="javascrip t:{if
          > (typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
          > __doPostBack('M yDataList$_ctl1 $edit_Button',' ')} ">Edit</a>
          >
          > In the above example, the function 'EnableValidato rs' does not fire. Has it
          > got something to do with the fact the id and name attributes are different?
          > I am unable to make the id and name attributes the same so is there anything
          > I can do to get it to work?
          >[/color]

          From the HTML spec at W3C.org:

          "The id and name attributes share the same name space. This means that
          they cannot both define an anchor with the same name in the same
          document. It is permissible to use both attributes to specify an
          element's unique identifier for the following elements: A, APPLET,
          FORM, FRAME, IFRAME, IMG, and MAP. *When both attributes are used on a
          single element, their values must be identical.*" (my emphasis).

          <URL: http://www.w3.org/TR/html4/struct/links.html#h-12.2.3>

          As for the rest of your element...

          Not sure what you are trying to achieve. If your intention is for
          EnableValidator s to run onmousedown, then for the script attached to
          the href to execute, it does not work in all browsers. Safari (and
          maybe others) will not run the script on the href if another function
          fires (onclick, onmousedown, etc.).

          The usual idea is to have the href go to a useful page for those with
          JavaScript disabled, then have the onmousedown end with

          return false;

          which stops the browser from following the href link if javascript is
          enabled.

          Then add the script you have on the href to the end of the onmousedown:

          <a id="MyDataList_ _ctl1_edit_Butt on" NAME="edit_Butt on"
          href="aUsefulPa ge.html"
          OnMousedown="
          EnableValidator s('editGroup_') ;
          if (typeof(Page_Cl ientValidate) != 'function' ||
          Page_ClientVali date())
          __doPostBack('M yDataList$_ctl1 $edit_Button',' ');
          return false;
          ">Edit</a>

          The above is utterly untested 'cos I have no idea what all your
          functions are, however the syntax should be correct, except I haven't
          fixed your invalid id/name combination.

          Rob.

          Comment

          • RobG

            #6
            Re: why wont my function 'EnableValidato rs' fire?

            Dufus wrote:[color=blue]
            > <a id="MyDataList_ _ctl1_edit_Butt on" NAME="edit_Butt on"
            > OnMousedown="En ableValidators( 'editGroup_');" href="javascrip t:{if
            > (typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
            > __doPostBack('M yDataList$_ctl1 $edit_Button',' ')} ">Edit</a>
            >
            > In the above example, the function 'EnableValidato rs' does not fire. Has it
            > got something to do with the fact the id and name attributes are different?
            > I am unable to make the id and name attributes the same so is there anything
            > I can do to get it to work?
            >[/color]


            From the HTML spec at W3C.org:

            "The id and name attributes share the same name space. This means that
            they cannot both define an anchor with the same name in the same
            document. It is permissible to use both attributes to specify an
            element's unique identifier for the following elements: A, APPLET,
            FORM, FRAME, IFRAME, IMG, and MAP. *When both attributes are used on a
            single element, their values must be identical.*" (my emphasis).

            <URL: http://www.w3.org/TR/html4/struct/links.html#h-12.2.3>

            As for the rest of your element...

            Not sure what you are trying to achieve. If your intention is for
            EnableValidator s to run onmousedown, then for the script attached to
            the href to execute, it does not work in all browsers. Safari (and
            maybe others) will not run the script on the href if another function
            fires (onclick, onmousedown, etc.).

            The usual idea is to have the href go to a useful page for those with
            JavaScript disabled, then have the onmousedown end with

            return false;

            which stops the browser from following the href link if javascript is
            enabled.

            Then add the script you have on the href to the end of the onmousedown:

            <a id="MyDataList_ _ctl1_edit_Butt on" NAME="edit_Butt on"
            href="aUsefulPa ge.html"
            OnMousedown="
            EnableValidator s('editGroup_') ;
            if (typeof(Page_Cl ientValidate) != 'function' ||
            Page_ClientVali date())
            __doPostBack('M yDataList$_ctl1 $edit_Button',' ');
            return false;
            ">Edit</a>

            The above is utterly untested 'cos I have no idea what all your
            functions are, however the syntax should be correct, except I haven't
            fixed your invalid id/name combination.

            Rob.

            Comment

            • Dufus

              #7
              Re: why wont my function 'EnableValidato rs' fire?


              "RobG" <rgqld@iinet.ne t.auau> wrote in message
              news:41a08d39$0 $25762$5a62ac22 @per-qv1-newsreader-01.iinet.net.au ...[color=blue]
              > Dufus wrote:[color=green]
              >> <a id="MyDataList_ _ctl1_edit_Butt on" NAME="edit_Butt on"
              >> OnMousedown="En ableValidators( 'editGroup_');" href="javascrip t:{if
              >> (typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
              >> __doPostBack('M yDataList$_ctl1 $edit_Button',' ')} ">Edit</a>
              >>
              >> In the above example, the function 'EnableValidato rs' does not fire. Has
              >> it got something to do with the fact the id and name attributes are
              >> different? I am unable to make the id and name attributes the same so is
              >> there anything I can do to get it to work?
              >>[/color]
              >
              >
              > From the HTML spec at W3C.org:
              >
              > "The id and name attributes share the same name space. This means that
              > they cannot both define an anchor with the same name in the same
              > document. It is permissible to use both attributes to specify an
              > element's unique identifier for the following elements: A, APPLET,
              > FORM, FRAME, IFRAME, IMG, and MAP. *When both attributes are used on a
              > single element, their values must be identical.*" (my emphasis).
              >
              > <URL: http://www.w3.org/TR/html4/struct/links.html#h-12.2.3>
              >
              > As for the rest of your element...
              >
              > Not sure what you are trying to achieve. If your intention is for
              > EnableValidator s to run onmousedown, then for the script attached to
              > the href to execute, it does not work in all browsers. Safari (and
              > maybe others) will not run the script on the href if another function
              > fires (onclick, onmousedown, etc.).
              >
              > The usual idea is to have the href go to a useful page for those with
              > JavaScript disabled, then have the onmousedown end with
              >
              > return false;
              >
              > which stops the browser from following the href link if javascript is
              > enabled.
              >
              > Then add the script you have on the href to the end of the onmousedown:
              >
              > <a id="MyDataList_ _ctl1_edit_Butt on" NAME="edit_Butt on"
              > href="aUsefulPa ge.html"
              > OnMousedown="
              > EnableValidator s('editGroup_') ;
              > if (typeof(Page_Cl ientValidate) != 'function' ||
              > Page_ClientVali date())
              > __doPostBack('M yDataList$_ctl1 $edit_Button',' ');
              > return false;
              > ">Edit</a>
              >
              > The above is utterly untested 'cos I have no idea what all your
              > functions are, however the syntax should be correct, except I haven't
              > fixed your invalid id/name combination.
              >
              > Rob.[/color]

              Thanks Rob. That was very helpful.


              Comment

              Working...