473,699 Members | 2,518 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

why wont my function 'EnableValidato rs' 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.
Jul 23 '05 #1
6 2130
Lee
Dufus said:

<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?


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

Jul 23 '05 #2

"Lee" <RE************ **@cox.net> wrote in message
news:cn******** *@drn.newsguy.c om...
Dufus said:

<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?


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


it works because I have stripped it down to just an alert box and have
successfully called it from elsewhere.
Jul 23 '05 #3
Dufus wrote:
<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?


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.
Jul 23 '05 #4
Dufus wrote:
<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?


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.
Jul 23 '05 #5
Dufus wrote:
<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?

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.
Jul 23 '05 #6

"RobG" <rg***@iinet.ne t.auau> wrote in message
news:41******** *************** @per-qv1-newsreader-01.iinet.net.au ...
Dufus wrote:
<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?

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.


Thanks Rob. That was very helpful.
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4046
by: JoeK | last post by:
Hey all, I am automating a web page from Visual Foxpro. I can control all the textboxes, radio buttons, and command buttons using syntax such as: oIE.Document.Forms("searchform").Item(<name>).Value = <myvalue> But I cannot control a dropdown with an onchange event. I can set the dropdown's value and selectedIndex, but then calling the onChange() or Click() does not do anything. It only seems to fire the onchange if I
45
3278
by: JaSeong Ju | last post by:
I would like to overload a C function. Is there any easy way to do this?
51
2548
by: Richard Hengeveld | last post by:
Hi all, I'm trying to understand how pointers for function parameters work. As I understand it, if you got a function like: void f(int *i) { *i = 0; }
5
3136
by: David Lozzi | last post by:
Hey All, I have a listbox that I would like to fire an event on doubleclick. the onDoubleClick property of the listbox isnt available be default, and I know it will work with Javascript, but how do I use javascript to run a server side function? Currently, I am using a Next button to accept the change, but it would be a faster UI to have the option to doubleclick instead. thanks a ton! david lozzi
2
1255
by: Adrian | last post by:
Hi everyone I have a web form where the validation works pefectly I copied the file, renamed it, and all of a sudden the validation stopped working(on the copied form). I have two panels on them. Both have validation controls in them and only one panel is visible at a time. The first panel validtion works fine, but the 2nd one doesnt. All it has is few textboxes, a requiredValidator and a image command button. The valdiation is server...
0
948
by: Phil | last post by:
I'm trying to add custom error handling for a 401 error. I've added this to my web.config: <location path="admin"> <system.web> <authorization> <allow roles="\" /> <deny users="*" /> </authorization> </system.web> </location>
5
1967
by: Gary Wessle | last post by:
Hi I have a group of functions which have the same signature. void fun_n(void); according to a conditional structure "be it if-else or switch-case" I get to choose which one to run. conditional structure verifies a short type and fires the fun_n in its block.
1
2651
by: Fendi Baba | last post by:
I wrote a simple validation routine. I am trying to trigger validation on group of fields if an option on another radio button is selected. Sub ValidateAdd_ServerValidate(ByVal objSource As Object, ByVal objArgs As ServerValidateEventArgs) if radioDbutton.SelectedItem.Value="yes" Then
3
7540
by: =?Utf-8?B?SlA=?= | last post by:
<asp:GridView ID="gridResults" runat="server" AutoGenerateColumns="False" Width="98%" PageSize="25" AllowPaging="True" OnSorting="gridResults_Sorting" OnPageIndexChanging ="gridResults_PageIndexChange" AllowSorting="True" OnRowDataBound="gridResults_RowDataBound" EnableViewState="False" OnRowCommand="gridResults_Command" ></asp:GridView> Inside a <ItemTemplateI have an <asp:ImageButton> The problem is that no matter what I do,...
0
8613
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9172
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7745
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4374
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.