View Single Post
Old 01-07-2012, 02:53 AM   #1
akwokpc
Junior Member
akwokpc began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Jan 2012
Device: kindle
get_browser fail to submit

Hi, I have problem on getting login from following page format

<form name="loginform" action="" onsubmit="return validform();" method="post" >
......
</form>

<script language="javascript">
function validform(){
var f = document.loginform;
var err = "";
var login = f.login.value;
var pwd = f.password.value;

if (login=="" || pwd=="") {
err = err + "xxx" + "\n";
}


var cookieName = "testHKEJCookie";
var cookieValue = "hkej_cookie_test";
document.cookie = cookieName + '=' + cookieValue + '; path=/';

var test_cookie = readCookie(cookieName);
if (test_cookie != cookieValue) {
return false;
}


if (err!="") {
alert(err);
return false;
}

f.action="_login_prg.jsp";
f.submit();
}


I guess the problem is, it use onsubmit in the form and pass to javascript for validation then submit to another jsp. I use the standard get_browser code to set the login,password and then submit. Tracked the result and seems nothing happen.

Any way to fix it, please advice.


Thanks,
apc
akwokpc is offline   Reply With Quote