Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Mobile / July 2004

Tip: Looking for answers? Try searching our database.

Barcode scanning on mobile WebForm - Setfocus issue on Textbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DotNetJunkies User - 06 Jul 2004 12:38 GMT
Hi,

Does anybody have a small sample solution for setting on page load the focus in a textbox on a mobile webform ?

This is required in order to be able to use a barcode scanner, who will enter data in this field ( ending with a tab or enter)

As soon as the data is entered this way, how can i raise a postback, so I get the server back to the server ?

Remark :
As the textbox on a mobile webform has no setfocus method the below code is mentioned as solution for setting the focus on a textbox on a mobile webfrom on several forums. BUT..
I dont get it working, because nowbody states the correct
<deviceFilters>  setting in the web.config...

Please help !

<mobile:DeviceSpecific id="DeviceSpecific1" runat="server">
   <Choice Filter="isHTML32"
Xmlns="http://schemas.microsoft.com/mobile/html32template";>
   <FooterTemplate>
       <script for="window" event="onload" language="javascript">
       <!--                    
window.document.Form1.txtFileNumber.focus();
       // -->
</script>
   </FooterTemplate>
   </Choice>
</mobile:DeviceSpecific>

---
Gybas Petr - 14 Jul 2004 14:53 GMT
Hi,

I'm actually writing the same application - ASP.NET application working with
bar code scanner. Here is form, that works fine:

<mobile:Form id="FormEANFind" runat="server" Paginate="True"
PagerStyle-NextPageText="->" PagerStyle-PreviousPageText="<-"
 StyleReference="Form">
<mobile:DeviceSpecific id="DeviceSpecific1" runat="server">
  <Choice Filter="isHTML32"
Xmlns="http://schemas.microsoft.com/mobile/html32template">
   <HeaderTemplate>
    <mobile:Link id="LinkEANIndex" runat="server"
NavigateUrl="index.aspx">Index</mobile:Link>
   </HeaderTemplate>
  </Choice>
 </mobile:DeviceSpecific>EAN:
<mobile:TextBox id="edtEAN" runat="server"></mobile:TextBox>
<mobile:Command id="btnSubmitEAN" runat="server">Find</mobile:Command>
<mobile:Label id="lblEANError" runat="server"
StyleReference="error"></mobile:Label>
<mobile:Panel id="Panel1" runat="server">
  <mobile:DeviceSpecific id="DeviceSpecific5" runat="server">
   <Choice Filter="isHTML32"
Xmlns="http://schemas.microsoft.com/mobile/html32template">
    <ContentTemplate>
     <Script for="window" event="onload" language="jscript">
           window.FormEANFind.edtEAN.focus();
     </Script>
    </ContentTemplate>
   </Choice>
  </mobile:DeviceSpecific>
 </mobile:Panel>
</mobile:Form>

But trouble is to handle onchange event and take some action. I found on
Internet, that you should use such script (for example):

   window.FormEANFind.edtEAN.onchange = text_changed;
   function text_changed(e)
   {
       window.FormEANFind.btnSubmitEAN.click();
   }

It looks so fine, but it doesn't work. I'll post question in this newsgroup,
so check it for possible answer from another user.

pgyb

> Hi,
>
[quoted text clipped - 6 lines]
> Remark :
> As the textbox on a mobile webform has no setfocus method the below code is mentioned as solution for setting the focus on a textbox on a mobile
webfrom on several forums. BUT..
> I dont get it working, because nowbody states the correct
> <deviceFilters>  setting in the web.config...
[quoted text clipped - 17 lines]
>
>  Our newsgroup
engine supports Post Alerts, Ratings, and Searching.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.