Hello Alan,
I think you could contact Steve in the group or email to see if he could provide more info. I suggest you provide detailed error
message and the info that where the error happened. Thanks.
Best regards,
Yanhong Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
!From:
al**********@ya hoo.com (Alan)
!Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
!Subject: Re: Setting Focus on field when RequiredFieldVa lidator fails - This Works!
!Date: 31 Jul 2003 11:50:51 -0700
!Organization:
http://groups.google.com/
!Lines: 103
!Message-ID: <83************ **************@ posting.google. com>
!References: <ut************ **@TK2MSFTNGP11 .phx.gbl> <Xj************ **@cpmsftngxa09 .phx.gbl>
!NNTP-Posting-Host: 12.150.117.131
!Content-Type: text/plain; charset=ISO-8859-1
!Content-Transfer-Encoding: 8bit
!X-Trace: posting.google. com 1059677452 4261 127.0.0.1 (31 Jul 2003 18:50:52 GMT)
!X-Complaints-To:
gr**********@go ogle.com
!NNTP-Posting-Date: 31 Jul 2003 18:50:52 GMT
!Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!new sfeed00.sul.t-online.de!t-online.de!news-spur1.maxwell.s yr.edu!
news.maxwell.sy r.edu!sn-xit-03!sn-xit-04!sn-xit-06!sn-xit-09!supernews.co m!postnews1.goo gle.com!not-for-mail
!Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1638 85
!X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
!
!Hi,
!I tried this and receive an error message from a part of the code that
!i'm not messing with at all....
!
!y******@online .microsoft.com (Yan-Hong Huang[MSFT]) wrote in message news:<Xj1VtJ5PD HA.1272
@cpmsftngxa09.p hx.gbl>...
!> Hello Steve,
!>
!> Thanks very much for the post in the group. I will look into it and file
!> this into our knowlege base database. We are looking at continual
!> improvement in VS.NET, and it's this kind of feedback that let's us know
!> what things you're trying to do, that we haven't yet exposed for you.
!>
!> Thanks again and hope you enjoy the group.
!>
!> Best regards,
!> yhhuang
!> VS.NET, Visual C++
!> Microsoft
!>
!> This posting is provided "AS IS" with no warranties, and confers no rights.
!> Got .Net?
http://www.gotdotnet.com
!> --------------------
!> !From: "Steve Yerkes" <st**********@h ealth.net>
!> !Subject: Setting Focus on field when RequiredFieldVa lidator fails - This
!> Works!
!> !Date: Sun, 29 Jun 2003 04:24:36 -0700
!> !Lines: 759
!> !MIME-Version: 1.0
!> !Content-Type: multipart/mixed;
!> ! boundary="----=_NextPart_000_ 000B_01C33DF6.5 957C7C0"
!> !X-Priority: 3
!> !X-MSMail-Priority: Normal
!> !X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
!> !X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
!> !Message-ID: <ut************ **@TK2MSFTNGP11 .phx.gbl>
!> !Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
!> !NNTP-Posting-Host: adsl-63-204-75-83.dsl.scrm01.p acbell.net 63.204.75.83
!> !Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP11.phx.g bl
!> !Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1556 75
!> !X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
!> !
!> !There seems to be way too much confusion over how to set focus on the a
!> field using a field validator. I looked all over the web and found people
!> trying to do this, but not getting anywhere. There are a couple of people
!> selling components... but that is not really an option for me... So, I
!> took the plunge and modified the "WebUIValidatio n.js" file to make it
!> happen... After tracing through file, I figure it out. It was actually
!> pretty easy... I am really surprised that Microsoft did not include this
!> functionality by default... anyway, here is the solution and code for you
!> all to tweak.. :-)
!> ! 1.. Create an ASP.NET web application in C#
!> ! 2.. Create some form elements
!> ! 3.. Drag a RequiredFieldVa lidator next to one of your fields
!> ! 4.. Build and browse
!> ! 5.. In your browser, view the html source code.
!> ! 6.. Search for a string in the source code called "WebUIValidatio n.js"
!> and take a note of the full path. You will need to open this file in the
!> next step. For example, my full path was...
!> !
!> C:\Inetpub\wwwr oot\aspnet_clie nt/system_web/1_0_3705_288/WebUIValidation .js
!> ! 7.. So, go ahead and open the file from step 6: "WebUIValidatio n.js" ***
!> Make a backup first (just in case!)
!> ! 8.. We are only going to modify the "ValidatorUpdat eIsValid()" function.
!> Modify the function to look like the following (I have included the entire
!> function here... so you can actually just overwrite yours with this one):
!> ! function ValidatorUpdate IsValid() {
!> ! var i;
!> ! for (i = 0; i < Page_Validators .length; i++) {
!> ! if (!Page_Validato rs[i].isvalid) {
!> ! Page_IsValid = false;
!> ! //---[ YERKES * 06/29/03 ]--------------------------------------
!> ! // The code in this function was added to allow field
!> ! // focusing when a validator is not valid.
!> ! //
!> ! // Uncomment the following 'alert' if you want a pop-up
!> ! // to display the error message along with it being dispalyed
!> ! // on the form.
!> ! //--------------------------------------------------------------
!> ! //alert(Page_Vali dators[i].errormessage);
!> ! var strControlToVal idate = Page_Validators[i].controltovalid ate;
!> ! var strControlType =
!> document.forms[0].elements[strControlToVal idate].type;
!> ! if (strControlType != "text"){
!> ! document.forms[0].elements[strControlToVal idate][0].focus();
!> ! return
!> ! } else {
!> ! document.forms[0].elements[strControlToVal idate].focus();
!> ! return;
!> ! }
!> ! }
!> ! }
!> ! Page_IsValid = true;
!> ! }
!> ! 9.. Save this File and "refesh" your aspx page in the browser. The
!> changes should have taken effect.
!> !That's it... this works for text fields and radiobuttonlist s... that is
!> all I have tested but it should set focus to any field if it fails any
!> validation for any reason (and not submt the form, of course).
!> !I have also attached my WebUIValidation .js just so you can have the whole
!> thing.. but like I said, we only added a couple lines of code to 1
!> function... not bad. :-)
!> !Peace out and remember.. J2EE is for punks..
!> !
!