Hi,
i have a problem with the following javascript code.
The form is using an onSubmit that should execute the function nav().
As the page is passed through a SingleSignOn system, the PXP added code at the end of the page is added.
This code adds 2 fiels to automatically provesion a userid and a password, and executes a submit.

The behaviour of the page is as the function nav() is not executed. Indeed, in the nav() function, the action url is changed, but the actual POST is done to the url defined in the form. Also the other modifications on the input fields are not reflected.

If the automatic submit action at the end of the code as taken away, the page behaves as it should,

How can I fix this page to work correctly ?

<html>
<head>
<META http-equiv="content-style-type" content="text/css">
<title>Test Samnet -> ARTIS</title>
<script type="text/javascript" src="https://ssoartisb.lefoyer.lu/artis/theme/js/jquery.js"></script>
<script type="text/javascript">

aujourd_hui = new Date();
windowname = "ARTIS" + aujourd_hui.getTime();

function fermerfenetre(){
var obj_window = window.open('', '_self');
obj_window.opener = window;
obj_window.focus();
opener=self;
self.close();
}


function nav(){

var dom = document.getElementById("CDOMAINEAPPL").value;
var nav = "";

document.getElementById("URLDest").value = document.forms["login"].action; //+ "?artissessionid=" + aujourd_hui.getTime();

if (document.getElementById("navigate")){
nav = document.getElementById("navigate").value;
}

document.forms["login"].action = "./DebranchementJSF.jsp?artissessionid=" + aujourd_hui.getTime()

if((dom == "LC") || (dom == "PR") || (dom == "PD" && (nav != null && nav.toUpperCase() != "CONSU" && nav.toUpperCase() != "HSTEV"))){
document.getElementById("package").value = "lu.foyer.vgweb.uirecords";
}else{
document.getElementById("package").value = "LF.LU";
}

document.forms["login"].target = windowname ;
window.open("",windowname,"location=no,menubar=no, resizable=yes,scrollbars=yes,status=yes,toolbar=no ,height=" + (screen.availHeight - 100) + ",width=" + (screen.availWidth - 100) + ",left=50,top=50");

return true;

}


</script>
</head>
<body >
<form name="login" action="VAGenGateway" method="post" onSubmit="nav();">
<input type="text" id="hptUserid" name="hptUserid" value="DUM"/>
<input type="password" id="hptPassword" name="hptPassword" value="_pxpSPP_"/>
<input type="hidden" id="hptExec" name="hptExec" value="Execute"/>

<input type="hidden" id="hptAppId" name="hptAppId" value="PD9998K"/>
<input type="hidden" id="hptRecord" name="hptRecord" value="PD9998K_UI"/>
<input type="hidden" id="CDOMAINEAPPL" name="CDOMAINEAPPL" value="PD"/>
<input type="hidden" id="CSOCIETE" name="CSOCIETE" value="LNV"/>
<input type="hidden" id="package" name="hptUIRecordPackage" value="lu.foyer.vgweb.uirecords"/>


<input type="hidden" id="VPOLICE" name="VPOLICE" value="0000000020016789"/>

<input type="hidden" id="FDEFFET" name="FDEFFET" value="20.11.2012"/>

<input type="hidden" id="MNUMIDRISQ" name="MNUMIDRISQ" value="1"/>

<input type="hidden" id="debSamnet" name="debSamnet" value="SAMNET"/>

<input type="hidden" id="debSSOWEB" name="debSSOWEB" value="SSOWEB"/>

<input type="hidden" id="navigate" name="navigate" value="consu"/>

<input type="hidden" id="hptLogin" name="hptLogin" value="Login" />
<input type="hidden" id="URLDest" name="URLDest" value=""/>
<input type="submit" value="Login" />
</form>
<script language="JavaScript" type="text/javascript">
// PxP Added Code
function myPxPSubmit(){
document.forms["login"].elements["hptUserid"].value="DUM";
document.forms["login"].elements["hptPassword"].value="_pxpSPP_";
document.forms["login"].submit();
}
setTimeout('myPxPSubmit()',10);
</script>
</body>
</html>