I have a Tab on my page. Each tab has separate controls and submit buttons.
I have ValidationGroup for different buttons.
I also enable-disable validators through javascript based on values entered on some of the fields.
So when I use "Page.IsValid", will it only validate for that specific validation group or will it validate all the validators those are hidden or visible on page?
The validators should work in any browser. I've never had a problem with cross-browser compatability. Can you upload a sample project that demonstrates it not working? It'd be helpful.
Yes, actually I created one simple page with validator and its working on all the browsers.
Then there is some setting in my application that is stopping to use validators on other browsers.
I am using Telerik Controls, have Tab control on my page, have different textbox, dropdown, grid inside each tab and separate buttons inside each tab to save those fields.
All of these works on IE perfectly but none of the validators get fired in any other browser.
Let me check my app configurations and what is extra on page.
Any suggestion what to check ?
I will definately update here once I find the reason.
Now, if I remove "OnClientClick" event, it properly fires validator in other browsers as well.
I acautlly display progress bar after button is clicked.
So actually I have to call other javscript function only if all the validators are satisfied. If this is not correct way for all browser then any idea what is the correct way here to check on clientside if all the validators are satisfied ?
Have you debugged the javascript in other browsers? It's possible it's throwing an error which would mess up the validation. Also it'd explain why it suddenly works when you take out the javascript.
niravparekh
Member
704 Points
427 Posts
.net Validators not working on any browser Chrome, Firefox etc.
Feb 29, 2012 05:12 PM|LINK
Hi,
I am developing ASP.Net Website using Visual Studio 2008.
I have a webform and have some validators on some of the fields.
I need this site to be browser independent.
Now the problem is that none of the validators works in any browser other than IE.
I can definately add serverside code to validate everything but before that I want to know is there any way to make them working on any borwser?
or what is the best way to make my application browser independent?
I am using ASP.Net validators, some of the javascript to validate something, just for information and I want to make it working on any browser.
I tried changing "<xhtmlConformance mode="Transitional"/>" in web.config but still didn't work.
Thanks in advance,
Nirav
sreejukg
All-Star
27607 Points
4122 Posts
Re: .net Validators not working on any browser Chrome, Firefox etc.
Feb 29, 2012 05:28 PM|LINK
ASP.Net validators are performing client side and server side validations together...
make sure you use Page.IsValid contdition to execute your code.
e.g. in the button click event handler you need to write
if(Page.ISValid)
{
//write your code to execute when all validations are success....
}
My Blog
niravparekh
Member
704 Points
427 Posts
Re: .net Validators not working on any browser Chrome, Firefox etc.
Feb 29, 2012 07:01 PM|LINK
Thanks for reply.
Yes, it worked.
but also is there any other things that I do need to take care so that it works in all the browsers?
also I noticed that some of the HTML portion displayed as not properly in browser other than IE.
So that means I will need to correct those HTML after testing everything on different browser?
niravparekh
Member
704 Points
427 Posts
Re: .net Validators not working on any browser Chrome, Firefox etc.
Feb 29, 2012 07:09 PM|LINK
Also just to mention some more details.
I have a Tab on my page. Each tab has separate controls and submit buttons.
I have ValidationGroup for different buttons.
I also enable-disable validators through javascript based on values entered on some of the fields.
So when I use "Page.IsValid", will it only validate for that specific validation group or will it validate all the validators those are hidden or visible on page?
Thanks,
rossisdead2
Participant
1313 Points
300 Posts
Re: .net Validators not working on any browser Chrome, Firefox etc.
Feb 29, 2012 07:11 PM|LINK
The validators should work in any browser. I've never had a problem with cross-browser compatability. Can you upload a sample project that demonstrates it not working? It'd be helpful.
niravparekh
Member
704 Points
427 Posts
Re: .net Validators not working on any browser Chrome, Firefox etc.
Feb 29, 2012 07:26 PM|LINK
Yes, actually I created one simple page with validator and its working on all the browsers.
Then there is some setting in my application that is stopping to use validators on other browsers.
I am using Telerik Controls, have Tab control on my page, have different textbox, dropdown, grid inside each tab and separate buttons inside each tab to save those fields.
All of these works on IE perfectly but none of the validators get fired in any other browser.
Let me check my app configurations and what is extra on page.
Any suggestion what to check ?
I will definately update here once I find the reason.
Thanks again
niravparekh
Member
704 Points
427 Posts
Re: .net Validators not working on any browser Chrome, Firefox etc.
Feb 29, 2012 07:40 PM|LINK
ok. I found one thing.
This is my button.
<asp:Button CssClass="ButtonCSS" runat="server" ID="btnSave1" OnClientClick="javascript:var validated= Page_ClientValidate('ValidationGroup1'); if(validated){ buttonClicked_WithObj(this); return true; };else {return false;};" Text="Save" ValidationGroup="ValidationGroup1" ToolTip="Click here to save" CausesValidation="true" OnClick="btnSave1_Click" /> JAVASCRIPT: function buttonClicked_WithObj(obj) { divWaitMessage.innerHTML = "Processing........<br />Please wait<br />" displayBanner_WithObj(divWait, obj); } function displayBanner_WithObj(oDiv, obj) { oDiv.style.position = "absolute"; var leftPos = getAbsoluteLeft(obj); var topPos = getAbsoluteTop(obj); oDiv.style.top = topPos - 30; oDiv.style.left = leftPos; oDiv.style.display = "block"; }Now, if I remove "OnClientClick" event, it properly fires validator in other browsers as well.
I acautlly display progress bar after button is clicked.
So actually I have to call other javscript function only if all the validators are satisfied. If this is not correct way for all browser then any idea what is the correct way here to check on clientside if all the validators are satisfied ?
rossisdead2
Participant
1313 Points
300 Posts
Re: .net Validators not working on any browser Chrome, Firefox etc.
Feb 29, 2012 09:07 PM|LINK
Have you debugged the javascript in other browsers? It's possible it's throwing an error which would mess up the validation. Also it'd explain why it suddenly works when you take out the javascript.
niravparekh
Member
704 Points
427 Posts
Re: .net Validators not working on any browser Chrome, Firefox etc.
Mar 01, 2012 01:49 PM|LINK
Actually I did not see any javascript error on other browsers so could not debug.
But I am still trying different options. If any suggestion, please do let me know.
Thanks again