473,396 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

disable requiredfieldvalidator when clicking on submit button

I have one form on the page but have multiple submit buttons for different
elements. When clicking on a button not associated with the required
elements the validator popup still comes up.

How can I disable requiredfieldvalidator fields when I click on non
associated button?

Cheers
James

Nov 18 '05 #1
4 10661
James,

That depends. If the button does not have to be associated with any
validators on the page at all then you can set the button's CausesValidation
property to false.

If the button has to trigger some validators but not others then you'll have
to create a javascript that fires when the button is clicked. The javascript
would then have to set each validator's "enabled" attribute to false (in the
client side code) for each validator that shouldn't fire.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"James Brett" <ja*********@unified.co.uk> wrote in message
news:e5**************@TK2MSFTNGP10.phx.gbl...
I have one form on the page but have multiple submit buttons for different
elements. When clicking on a button not associated with the required
elements the validator popup still comes up.

How can I disable requiredfieldvalidator fields when I click on non
associated button?

Cheers
James

Nov 18 '05 #2
Set the CausesValidation attribute for the 'non-associated' Button to false.

Cheers,
Wim Hollebrandse
http://www.wimdows.net
http://www.wimdows.com

"James Brett" <ja*********@unified.co.uk> wrote in message
news:e5**************@TK2MSFTNGP10.phx.gbl...
I have one form on the page but have multiple submit buttons for different
elements. When clicking on a button not associated with the required
elements the validator popup still comes up.

How can I disable requiredfieldvalidator fields when I click on non
associated button?

Cheers
James

Nov 18 '05 #3
How is this done when the button already has an onClick event for the
validator? eg

<input type="submit" name="btnDataset" value="Update Dataset" onclick="if
(typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
language="javascript" id="btnDataset" class="button" />

Cheers
James
"S. Justin Gengo" <sj*****@aboutfortunate.com> wrote in message
news:uO**************@TK2MSFTNGP11.phx.gbl...
James,

That depends. If the button does not have to be associated with any
validators on the page at all then you can set the button's CausesValidation property to false.

If the button has to trigger some validators but not others then you'll have to create a javascript that fires when the button is clicked. The javascript would then have to set each validator's "enabled" attribute to false (in the client side code) for each validator that shouldn't fire.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"James Brett" <ja*********@unified.co.uk> wrote in message
news:e5**************@TK2MSFTNGP10.phx.gbl...
I have one form on the page but have multiple submit buttons for different elements. When clicking on a button not associated with the required
elements the validator popup still comes up.

How can I disable requiredfieldvalidator fields when I click on non
associated button?

Cheers
James


Nov 18 '05 #4
All working fine now

Cheers
James

"James Brett" <ja*********@unified.co.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
How is this done when the button already has an onClick event for the
validator? eg

<input type="submit" name="btnDataset" value="Update Dataset" onclick="if
(typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
language="javascript" id="btnDataset" class="button" />

Cheers
James
"S. Justin Gengo" <sj*****@aboutfortunate.com> wrote in message
news:uO**************@TK2MSFTNGP11.phx.gbl...
James,

That depends. If the button does not have to be associated with any
validators on the page at all then you can set the button's

CausesValidation
property to false.

If the button has to trigger some validators but not others then you'll

have
to create a javascript that fires when the button is clicked. The

javascript
would then have to set each validator's "enabled" attribute to false (in

the
client side code) for each validator that shouldn't fire.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"James Brett" <ja*********@unified.co.uk> wrote in message
news:e5**************@TK2MSFTNGP10.phx.gbl...
I have one form on the page but have multiple submit buttons for different elements. When clicking on a button not associated with the required
elements the validator popup still comes up.

How can I disable requiredfieldvalidator fields when I click on non
associated button?

Cheers
James



Nov 18 '05 #5

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

Similar topics

3
by: Trond | last post by:
I have an ASP.NET page with various textboxes, checkboxes and a date picker. Attached to some of these controls i have RequiredFieldValidator. One of the textboxes has a button next to it. When...
2
by: techfuzz | last post by:
I scoured this group and others looking for the best way to disable a button after the first click to prevent multiple submissions, but never did find anything that worked like they said it would. ...
14
by: Sinity | last post by:
Anyone knows the method/codes to disable the clicked button after first click by using .aspx-- to prevent people to click many time when waiting for the server response. I tried to do this by...
4
by: James | last post by:
Hello, I have a RequiredFieldValidator for several textbox controls on a form. Here's an example with the RequiredFieldValidator. EnableClientScript, Enabled, and Visible are set to true for...
2
by: Fluxray | last post by:
--Background: I have a webform including a datagrid. The datagrid is using template. Its ItemTemplate is used to display a look-up-table with labels. its EditItemTemplate is used to edit a row in...
2
by: Hongbo | last post by:
Hi, I have a Asp.Net written in C#. It serve as information input form. The form encounters sort of random problem with the email field and state field. I have validator attached with these 2...
16
by: Barry Gilmore | last post by:
Is there a way to disable a button after it is clicked? I am trying to avoid having someone click on it twice while they wait for it to process. Thank you!
1
by: Arpan | last post by:
Suppose I have the following RequiredFieldValidator control which validates a TextBox: <form id="form1" runat="server"> <asp:TextBox id="txtVal" runat="server"/> <asp:RequiredFieldValidator...
0
by: =?Utf-8?B?QWJieQ==?= | last post by:
I have one form on the page but have multiple submit buttons for different elements. When clicking on a button not associated with the required elements the validator popup still comes up. How...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.