[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.mobile

Barcode scanning on mobile WebForm - Setfocus issue on Textbox

DotNetJunkies User

7/6/2004 11:38:00 AM

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>



---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.DotNetJunkies.com/... Our newsgroup engine supports Post Alerts, Ratings, and Searching.
1 Answer

Gybas Petr

7/14/2004 1:53:00 PM

0

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





"DotNetJunkies User" <User@-NOSPAM-DotNetJunkies.com> wrote in message
news:Ou$1y20YEHA.1048@tk2msftngp13.phx.gbl...
> 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>
>
>
>
> ---
> Posted using Wimdows.net NntpNews Component -
>
> Post Made from http://www.DotNetJunkies.com/... Our newsgroup
engine supports Post Alerts, Ratings, and Searching.