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> <a href=”#” onClick=”return gotoMainMenu();return false;” class=”button”>Hoved menu</a> </nobr>
</span>
<span class=”buttonPos”>
<nobr> <a href=”#” onClick=”return logOff();return false;” class=”button”>log af </a> </nobr>
</span>
</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> <a href=”#” onClick=”return doSubmit(document.forms[0]);return false;” class=”button”>ok</a> </nobr>
</span>
<span class=”buttonPos”>
<nobr> <a href=”#” onClick=”return cancel();return false;” class=”button”>fortryd</a> </nobr>
</span>
</form>
</body>
</html>
Thanks in advance!
Per