?
Solved

Disable Validation for HTML submit button

Posted on 2013-10-30
9
Medium Priority
?
264 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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 

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

DFW AZURE MEETUP TONIGHT FRI 6PM

We will be discussing what Azure Stack is, how does it fit into the suit of offerings that Azure has currently, and where can it fit into your organizations technology stack. We will also be discussing limitations of the platform while covering various applicable scenarios.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

800 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