validation controls and custom javascript functions

C

Chris Barrow

Hi everyone,

Does anyone know if it is possible to append your own
javascript function onto the end of a button's onclick
method when validation controls are used?

Here is an example of the script that is generated when
validation controls are use on the form:

onclick="{if (typeof(Page_ClientValidate) != 'function'
|| Page_ClientValidate()) __doPostBack('btnOk','')}

What I would like to do is append my own custom function
onto the end of this statement. For example:

onclick="{if (typeof(Page_ClientValidate) != 'function'
|| Page_ClientValidate()) __doPostBack
('btnOk','')};showFormSummary();"

Unfortunately I been unable to do so. Regardless of how I
try to append this statement, whether it is in the .aspx
page using the button's client onclick method, or using
the button's "attributes" property collection on the
server side, the validation codes are always appended last
after my own script statements.

If anyone has some suggestion on the matter, I would
greatly appreciate it.

Thanks,

Chris...
 
C

Chris Jackson

You can always just set up your own button that calls the validation
controls yourself. Anything that ASP.NET renders, you can just render
yourself and leave it out of the picture. You are already reading the
source - just call the function you want from an <input type=button>, and
then have that function call the client-side validation function.
Alternately, you could do your validation on the server (which you should be
doing anyway, because it's easy for a client to tamper with validation, and
server-side validation does not happen by default).
 
C

Chris Barrow

-----Original Message-----
You can always just set up your own button that calls the validation
controls yourself. Anything that ASP.NET renders, you can just render
yourself and leave it out of the picture. You are already reading the
source - just call the function you want from an <input type=button>, and
then have that function call the client-side validation function.
Alternately, you could do your validation on the server (which you should be
doing anyway, because it's easy for a client to tamper with validation, and
server-side validation does not happen by default).

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Shell/UI
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--




.
Hi Chris,

Thanks for the response. I'll take a look at these
suggestions and go from there.

Thanks,

Chris...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top