Re: JavaScript or Asp, Set Focus to Table or Heading or Label Or something?

  • From: "Richard Thomas" <rthomas@xxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Tue, 23 Oct 2007 19:22:00 -0400

Hi Arnold:
Looking at the code there may be something but I'm not sure.
I put my code below.  
Make sure your Validation Button has the CausesValidation property set to true;
Make sure the Validation control for the TextBox or whatever the 

Edit field is,has a message defined for it;
That is what will be displayed I believe in the PopUp.
If the above  ideas and the code below don't help,
Give me a copy of your Validation and Edited Field code.
Last thing, if you have JavaScript turned off it may impact some things like 
PopUps.  I'm not sure if this is a JavaScript generated PopUp but it well might 
be knowing how Microsoft generates client-side actions.  Most all computers 
have it turned on by default so unless you turned it off it is likely on.
Here are some extracts of my code that might help:
Please ignore the colors and spacing as they were just test values and will be 
overwritten and replaced with skins and css later.
Rick:

<asp:ValidationSummary 
ID="ValidationSummary1" 
runat="server" 
Font-Size="16pt" 
BackColor="Navy" 
ForeColor="Yellow" 
BorderColor="White" 
BorderStyle="Solid" 
BorderWidth="5pt" 
HeaderText="Error List" 
ValidationGroup="MetrixValidationGroup" 
Height="30pt" 
ShowMessageBox="true" 
Width="30pt" 
ShowSummary="false" />    
Note:
I templatized the Navigation buttons for the Wizard so I could tweak them and 
this code and the code for one of my Validation Controls that are read by the 
Summary Control above is below.

<StepNavigationTemplate>
<asp:Button 
ID="StepPreviousButton" 
runat="server" 
ValidationGroup="MetrixValidationGroup" 
CausesValidation="True"
CommandName="MovePrevious" 
Text="Previous" />
<asp:Button 
ID="StepNextButton" 
runat="server" 
ValidationGroup="MetrixValidationGroup" 
CausesValidation="True"
CommandName="MoveNext" 
Text="Next" />
 </StepNavigationTemplate>
 <SideBarTemplate>
  <asp:DataList ID="SideBarList" runat="server">
   <SelectedItemStyle Font-Bold="True" />
   <ItemTemplate>
<asp:LinkButton 
ID="SideBarButton" 
runat="server" 
BackColor="Black" 
BorderStyle="None" 
ForeColor="BlanchedAlmond" 
ValidationGroup="MetrixValidationGroup" 
CausesValidation="True">
</asp:LinkButton>
   </ItemTemplate>
  </asp:DataList>
 </SideBarTemplate>
<FinishNavigationTemplate>
  <asp:Button ID="FinishPreviousButton" runat="server" 
CausesValidation="False" CommandName="MovePrevious" Text="Previous" />
  <asp:Button ID="FinishButton" runat="server" 
CommandName="MoveComplete" 
Text="Finish Up" 
ValidationGroup="MetrixValidationGroup" 
CausesValidation="True"  />
 </FinishNavigationTemplate>
<asp:TextBox 
ID="tbDivRateMin" 
SkinId="SlBordered" 
runat="server" 
Width="50pt" Text="2.5"></asp:TextBox>
<asp:RangeValidator 
ID="rngDivRateMinValidator" 
ControlToValidate="tbDivRateMin" 
ErrorMessage="Range Error: Div. Rate Min. Value" 
runat="server" 
Font-Size="16pt" 
MaximumValue="99" MinimumValue="0" 
ValidationGroup="MetrixValidationGroup" 
Type="Double" 
Display="None" 
SetFocusOnError="True"></asp:RangeValidator>
<asp:RequiredFieldValidator 
ID="reqDivRateMinValidator" 
ControlToValidate="tbDivRateMin" 
ErrorMessage="Required Field Error: Div. Rate Min. Value Is Empty" 
Font-Size="16pt" 
runat="server" 
ValidationGroup="MetrixValidationGroup" 
SetFocusOnError="True" 
Display="None"></asp:RequiredFieldValidator>

  ----- Original Message ----- 
  From: Arnold Bailey 
  To: programmingblind@xxxxxxxxxxxxx 
  Sent: Tuesday, October 23, 2007 4:12 PM
  Subject: Re: JavaScript or Asp, Set Focus to Table or Heading or Label Or 
something?


  Hi Rick,

  I can't seem to get the messagebox to popup on an error. That is why I fooled 
around with the summary. I thought it might be a firefox issue; but, it doesn't 
show on IE either. This is my statement: 

  <asp:ValidationSummary
  ShowMessageBox="true"
  ShowSummary="false"
  HeaderText="You must enter a value in the following fields:"
  EnableClientScript="true"
  runat="server"/> 

  I do have a routine called onclick of the submit button.

  Is there something I'm missing?

  Arnold


  On 10/23/07, Richard Thomas < rthomas@xxxxxxxxxxx> wrote:
    Hi Arnold:
    I haven't tried moving the ValidationSummary control around.  I used it so 
I could get the PopUp box and then hid the Summary control itself.  
    The Validation Control sets focus to the Error TextBox so if there is an 
error I get the PopUp message, hit ok and am placed in the offending TextBox.
    If you want the complete list of errors in the Summary Control I should 
imagine you could move it around.  You may have to templatize it if you can do 
that.  If you are not sure about how to do that I'll take a look see.
    I just found messing with the SummaryControl a pain going back and forth 
between it and the various TextBoxes that may have had errors so just made it 
invisible.
    Rick Farmington Mich. USA
    With focus set to the Validation Error Control
      ----- Original Message ----- 
      From: Arnold Bailey 
      To: programmingblind@xxxxxxxxxxxxx 
      Sent: Tuesday, October 23, 2007 12:35 PM
      Subject: Re: JavaScript or Asp, Set Focus to Table or Heading or Label Or 
something?


      Rick,

      I'm interested in the same issue. I'm using asp.net and would like the 
validationsummary to be placed above the form, so that the user will have a 
list of the errors.  I can't figure out how to do this.  I thought of the idea 
of setting focus to the error list as an alternative. I hope someone can give 
an insight into the best way to present form errors with asp.net to persons who 
are using jaws.

      Arnold 


      On 10/22/07, Richard Thomas < rthomas@xxxxxxxxxxx> wrote: 
        Hi Guys:
        I have  set focus to controls in a WebPage using JavaScript, Asp Focus 
and a Recursive function through a nested control.  All these set focus to 
TextBoxes, TreeViewNodes or other input items.  I would like to set focus to a 
point just prior to some of these controls so the Screen reader will read the 
control's text with the first down arrow instead of having to back up and read 
the text.  Is there a way to define a field or somethingg that will not read as 
anything but act as an input field so I can set focus to it?
        I tried a anchor tag but no go. 
        Thanks for any ideas:
        Rick Farmington Mich. USA



      -- 
      Arnold
      http://www.blind411.org/ITCareers/ 



  -- 
  Arnold
  http://www.blind411.org/ITCareers/ 

Other related posts: