02-01-2011 02:25 AM - edited 02-01-2011 07:00 AM
Hi All,
I'm new to blackberry programming. I'm developing a simple login page consisting of username & password. In javascript i need to authenticate the user by calling .net web-service.
The code is given below :- login.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitiona
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MS3 Project</title>
<script type="text/javascript" src="logic.js"></script>
<style type="text/css">
<!--
.style1 {
font-size: 18px;
font-weight: bold;
}
-->
</style>
<script type="text/javascript">
var WSresponse = new Array();
var i;
function initPage()
{
service.useService("http://59.90.208.182:8080/MS3service/DataService.a
}
function login_info()
{
alert("login_info function called");
try
{
var username = document.getElementById("idUser").value;
var password = document.getElementById("idPassword").value;
alert(username);
alert(password);
alert("calling web-service");
WSresponse = service.DataService.callService(loginDetails,"Auth
alert("web-service executed...");
}
catch(err)
{
alert("Error description: " + err.description);
}
}
function loginDetails(result)
{
alert("in loginDetails");
if(result.error)
{
alert("ERROR");
}
else
{
alert("Length of result is ==== "+result.length);
}
}
</script>
</head>
<body onload="initPage()">
<DIV id="service" STYLE="behavior:url(webservice.htc)">
</DIV>
<form id="login" name="login_form" method="post" action="">
<table width="100%" border="0">
<tr>
<td width="41%"> </td>
<td width="10%"> </td>
<td width="45%"> </td>
<td width="4%"> </td>
</tr>
<tr>
<td colspan="4"><div align="center" class="style1">Login Page</div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><strong>User Name :</strong></td>
<td><input type="text" name="txtUserName" id="idUser" maxlength="15"/></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><strong>Password :</strong></td>
<td><input type="password" name="txtPassword" id="idPassword" maxlength="15"/></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td align="center"><input type="button" name="submitButton" id="submitBtn" value="Submit" onclick="login_info()"/> </td>
<td> <input type="reset" name="resetButton" id="resetBtn" value="Reset" /></td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>
For this I'm getting foll. exception in catch block :- "service.DataService" is null or not an object.
Sorry, If i've made any silly mistake. Please guide me for this.
02-02-2011 03:21 PM
Have you checked out the following post?
02-03-2011 01:32 AM
Thanks Tim.. My problem has been solved.
Your link was also helpful for me.. got some new to learn.
Please inform me about Blackberry Playbook Applications. I am developing applications on it.
Looking forward to your positive response. ![]()
02-03-2011 09:01 AM
What type of specific information are you looking for around PlayBook WebWorks development? We should be able to point you in the right direction.