[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

ASP Focus problem

Posted on 2016-11-08
3
Medium Priority
?
94 Views
Last Modified: 2016-11-21
I have an input box "DispatchNote", if this is blank I want to set the focus to it, if it is not blank I want to set the focus to SerialNo. I have tried this but it is not working: -
</head>
<% 
if Dnote = "" or isnull(Dnote) then
%>
<body bgcolor="#A1FC03" text="#000000">
<form name="AddSerials" action="Serials.asp" method="post" defaultfocus ="DispatchNote">  
<% 
Else
%>
<body bgcolor="#E5EC09" text="#000000">
<form name="AddSerials" action="Serials.asp" method="post" defaultfocus ="SerialNo">  
<% 
end if
%>

Open in new window

Can anyone help?
0
Comment
Question by:HKFuey
[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
  • 2
3 Comments
 
LVL 33

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 41879086
the defaultfocus attribute can only be used with .NET, not classic asp. you can use straight up JS to accomplish what you want:

<script type="text/javascript">
     function setFocus( val ){
          if( val == '' ||val == nul )
              document.getElementById('DispatchNote').focus();
          else
              document.getElementById('SerialNo').focus();
     }
</script>
</head>
<body bgcolor="#A1FC03" text="#000000" onload='setFocus()'>
<form name="AddSerials" action="Serials.asp" method="post">  

rest of html down here

Open in new window


this assumes your text fields have IDs labelled DispatchNote and SerialNo
0
 

Author Comment

by:HKFuey
ID: 41879093
Thanks, Big Monty. Going home now will try tomorrow.
0
 

Author Closing Comment

by:HKFuey
ID: 41895575
Thank you.
0

Featured Post

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!

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

649 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