/    Sign up×
Community /Pin to ProfileBookmark

Windows Mobile Explore – OnKeyPress or what?

Hi there.

I got this form containing 3 fields.
When a text is entered into one of the fields, the onkeypress event is triggered running a function, soposed to split the contents of the field into it self + the two others.
This functionallity works in ie6, but seems not to work in Windows mobile explorer when scanning the barcode.

Any one got an idea?

The code:

[QUOTE]

<html>
<head>

<script>
var pChanged = 1;
var pDialogAnswer;
function dialogAnswer(userAnswer){
if (userAnswer == ‘yes’){
pDialogAnswer=1;
}else if (userAnswer == ‘no’){
pDialogAnswer=0;
}

}

function gotoMainMenu(){
var text;
var answer;
//if in the middle of transaction display a warning screen
if (pChanged == 1){
text = ‘Klik OK for at returnere uden at gemme ‘;
//openWindow(‘dialog.htm?text=’+escape(text),230,135,’c’,’c’,window);
//if (pDialogAnswer == 1){
answer = window.confirm(text);
if (answer == 1){
window.location.href = ‘/sap(bD1kYSZjPTIyMSZ3PTExMjk2NDAr)/bc/bsp/sap/zpcsmobil/main.do’;
}
}else
window.location.href =’/sap(bD1kYSZjPTIyMSZ3PTExMjk2NDAr)/bc/bsp/sap/zpcsmobil/main.do’;
}

function logOff(){
var text;
if (pChanged == 1){
text = ‘Klik OK for at returnere uden at gemme ‘;
//openWindow(‘dialog.htm?text=’+escape(text),230,135,’c’,’c’,window);
//if (pDialogAnswer == 1){
answer = window.confirm(text);
if (answer == 1){
window.location.href = ‘/sap(bD1kYQ==)/public/bsp/sap/system/sessionexit.htm?application_list[1].exit_url=/sap(bD1kYSZjPTIyMSZ3PTExMjk2NDAr)/bc/bsp/sap/zpcsmobil/mro/step2.htm%3Fsap-sessioncmd=logoff’;
}
}else
window.location.href =’/sap(bD1kYQ==)/public/bsp/sap/system/sessionexit.htm?application_list[1].exit_url=/sap(bD1kYSZjPTIyMSZ3PTExMjk2NDAr)/bc/bsp/sap/zpcsmobil/mro/step2.htm%3Fsap-sessioncmd=logoff’;
}

function doSubmit(form){
//if any validation required call it up here
form.submit();
return false;
}

function cancel(){
var text;
if (pChanged == 1){
text = ‘Klik OK for at returnere uden at gemme ‘;
//openWindow(‘dialog.htm?text=’+escape(text),230,135,’c’,’c’,window);
//if (pDialogAnswer == 1){
answer = window.confirm(text);
if (answer == 1){
window.location.href = ‘/sap(bD1kYSZjPTIyMSZ3PTExMjk2NDAr)/bc/bsp/sap/zpcsmobil/mro/mro.do’;
}
}else
window.location.href =’/sap(bD1kYSZjPTIyMSZ3PTExMjk2NDAr)/bc/bsp/sap/zpcsmobil/mro/mro.do’;
}
function splitScanText(text){
var textStr;
if ( text != null && text.length>16 ){
textStr = text.substring(4,8);
document.forms[0].stge_loc.value = textStr;
textStr = text.substring(8,text.length);
document.forms[0].material.value = textStr;
textStr = text.substring(0,4);
document.forms[0].plant.value = textStr;
}
}
</script>
<link rel=”stylesheet” href=”../arlamro.css”>

<title>Retur fra service ordre </title>

</head>
<body class=”bspBody1″>
<table border=”0″ cellpadding=”0″ cellspacing=”0″ bgcolor=”#9FC0B0″ width=”100%” height=”23px”>
<tr>
<td>
<div class=”elementTitle”>Retur fra service ordre </div>
</td>
<td align=”right”>
<span class=”buttonPos”>
<nobr>&nbsp;<a href=”#” onClick=”return gotoMainMenu();return false;” class=”button”>Hoved menu</a>&nbsp;</nobr>
</span>&nbsp;
<span class=”buttonPos”>
<nobr>&nbsp;<a href=”#” onClick=”return logOff();return false;” class=”button”>log af </a>&nbsp;</nobr>
</span>&nbsp;
</td>
</table>

<body onload=”document.forms[0].material.focus()”>
<form action=”mro.do?OnInputProcessing(process)&view=maintenance&step=2″ method=”post”>
<input type=hidden name=MOVE_TYPE value=261><input type=hidden name=ORDERID value=5000041>
<div class=”elementText10″>Trin 2 af 3 (materiale) </div>
<table border=”0″ cellpadding=”2″ cellspacing=”0″ class=”elementText10″>
<tr>
<td>Ordre nr.</td>
<td>5000041</td>
<td>Mvt</td>
<td>261</td>
</tr>

<tr>

<td>Fabr.</td>
<td colspan=”3″><input name=”plant” type=”text” maxlength=”26″ class=”elementText10″ size=”25″ value=”” ></td>
</tr>
<tr>
<td>Lager </td>
<td colspan=”3″><input name=”stge_loc” type=”text” maxlength=”4″ class=”elementText10″ size=”25″ value=””></td>
</tr>
<tr>
<td>MatNr </td>
<td colspan=”3″><input name=”material” type=”text” maxlength=”18″ class=”elementText10″ size=”25″ onkeypress=”splitScanText(this.value);”></td>
</tr>
</table>

<br />
<span class=”buttonPos”>
<nobr>&nbsp;<a href=”#” onClick=”return doSubmit(document.forms[0]);return false;” class=”button”>ok</a>&nbsp;</nobr>
</span>&nbsp;
&nbsp;
<span class=”buttonPos”>
<nobr>&nbsp;<a href=”#” onClick=”return cancel();return false;” class=”button”>fortryd</a>&nbsp;</nobr>
</span>&nbsp;

</form>

</body>
</html>

[/QUOTE]

Thanks in advance!
Per

to post a comment
HTML

0Be the first to comment 😎

×

Success!

Help @oz1kad spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...