Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Disable Validation for HTML submit button

Posted on 2013-10-30
9
Medium Priority
?
270 Views
Last Modified: 2013-11-24
Hello,

I have web page designed in Visual Studio 2003.

On that page I have 20 text fields and a save button. (all ASP controls)

On some of the text fields there is a basic validation set. (to not allow empty fields to be saved)

For Save button there is a property called causesValidation that is set = True by default, so my validation works fine for this button.

However, in addition to all this, on the same page ,I have Upload file HMTL fields that include Browse and Upload buttons (in basic HTML, I believe)

I browse to the file I want to upload fine. When I click on Upload button, that click causes validation on my text fields (mentioned above)

How I can set the HTML submit button to NOT cause validation? and to simply proceed with the upload process only.

Thanks
0
Comment
Question by:Terrace
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 15

Expert Comment

by:Ess Kay
ID: 39611845
By "all the controls", do you include the buttons? Buttons and validators need to have separate validation groups assigned in order to be mutually exclusive.

Please validate that both submit buttons have a validation group assigned, and that all validators have a validation group assigned corresponding to the button that should cause that validator to validate.

As an alternative, you can set CausesValidation to false on the filter button if there needs be no validation performed at all.
0
 

Author Comment

by:Terrace
ID: 39612835
Hello,

thanks for your reply.
Currently none of the buttons have validation groups assigned.

Before the Upload button was on the page, I had only one button, Save button.

That Save button has causesvalidation = True, so that button triggers validation on ALL fields that have validation set.

I added Upload feature to this same page, so now I have Upload button too (this button is HTML). Now when this button is clicked it also triggers validation on ALL fields.

Since this Upload button is HTML, it does not have property causesvalidation, so I can not set any value to it.

Ideally I would like to force Upload button to NOT do any validation.

is there a way to set causesvalidation = FALSE to html upload/submit button ?

Thanks
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39617377
One option is to set validation group on all other controls with the save button. That way, upload button should not trigger validation as it would not be part of that group.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Terrace
ID: 39620145
That sounds like a plan.

Can you please give me an example of how that is done?

Ex.

If I have Textbox1 and Textbox2 with validation set on them.
How do I set that validation is triggered specificaly by buton Save only?

Thanks
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39620150
You just need to set the ValidationGroup property to same value on both textboxes and button.
0
 

Author Comment

by:Terrace
ID: 39621124
Thanks,

I am sure this is available in newere .NET frameworks, like 4.0 for example.

How to set the ValidatioGroups in .NET framework 1.1 ( Visual Studio 2003) ?

I don't see ValidationGroup property for textbox.

Maybe have to use JavaScript of some sort?

Thanks
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 39621176
Try just adding

ValidationGroup="groupname"

In aspx code manually.
0
 

Author Comment

by:Terrace
ID: 39623892
Thanks. I tried adding this in the html part of the page in textbox contol settings, but it did not work.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39624246
Can you show a simplified aspx source code?

Also, why html input and not ASP.NET button?
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question