- BlackBerry Support Community Forums
- Welcome & Introductions
- Announcements
- Your Stories
- Smartphones
- BlackBerry® Bold™ 9700 smartphone
- BlackBerry® Tour™ 9630
- BlackBerry Storm - BlackBerry 9500 Series Smartphone
- BlackBerry Bold - BlackBerry 9000 Series Smartphone -
- BlackBerry Curve - BlackBerry 8900 Series Smartphone
- BlackBerry 8800 Series Smartphone
- BlackBerry Curve 8500 Series Smartphone
- BlackBerry Curve - BlackBerry 8300 Series Smartphone
- BlackBerry Pearl - BlackBerry 8200 Series Smartphone
- BlackBerry Pearl- BlackBerry 8100 Series Smartphone -
- Other BlackBerry Smartphones and Devices
- General BlackBerry Smartphone Functions and Features
- BlackBerry Accessories
- Software
- BlackBerry® Desktop Software
- BlackBerry® for Mac
- BlackBerry® Device Software
- BlackBerry® Applications, Third-Party Applications & BlackBerry App World
- BlackBerry App World - General Discussions
- Downloaded Applications for BlackBerry Devices
- Solutions
- BlackBerry® Enterprise Server Version 5.0
- BlackBerry® Enterprise Solution
- BlackBerry® Internet Service
- BlackBerry® Professional Software and BlackBerry® Unite!
- BlackBerry® Training and Certification
- BlackBerry® Training and Certification
- BCP-410
- BlackBerry Development
- Dev Blog
- BlackBerry App World™ Development
- Java Development
- Web Development
- MDS Runtime Development
- BlackBerry Enterprise Server Development
- Product Management: The BlackBerry Application Platform
- BlackBerry Themes & Animated Graphics
- Community Forums Feedback
- Forum Feedback and Ideas
- BlackBerry Community Post
- BlackBerry Community Post
- Register
- ·
- Sign In
- ·
- Help
- ·
- New Topics
- ·
- New Posts
- BlackBerry Support Community Forums
- :
- BlackBerry Development
- :
- Web Development
- :
- Re: Urgent Help Please! Ajax Does Not Work in BB89...
- Subscribe to RSS Feed
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Urgent Help Please! Ajax Does Not Work in BB8900
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Flag for a Moderator
11-06-2009 10:41 AM
Hi everybody,
in a big trouble.. I have developed a very simple web application using Java, Spring, and AJAX. Page to login, on success, a form appears where the user has to fill and save thereafter.
In the form a number of select lists (drop-down combobox) are to be used. Some of them are disabled for the first time, by some actions (example filling a text field or selecting another list), the lists are to be enabled and filled using AJAX from a servlet.
This works with PC, with iPhone, with HTC (IE, Firefox, Opera...). But in BB9000 Emulator and in a BB8900 device I face the following problems (despite of that I enabled JavaScript):
1) text fields are disabled-enabled correctly, but drop-down lists are not disabled.
2) AJAX does not work, e.g., select a city does not trigger AJAX to bring the streets of that city.
3) DOM does not work .. e.g. pressing a button, no new <tr> <td> ... elements are added to the a table in the form.
Please help since my deadline is coming and I am in short of time!
Regards,
Solved! Go to Solution.
Re: Urgent Help Please! Ajax Does Not Work in BB8900
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Flag for a Moderator
11-06-2009 03:45 PM
JavaScript is turned off by default in the browser - have you checked to see if it's enabled?
Re: Urgent Help Please! Ajax Does Not Work in BB8900
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Flag for a Moderator
11-07-2009 04:05 AM
thank you for the reply...
I have already enabled it in Browser options
regarding the request to the servlet, it works, I have debugged it. The database connection is built and the query returns correct answer.
I still fight with the problem of getting the data back to the client. Maybe, the onreadystate does not work. The problem maybe a Javascript support leak. As I told you:
<input id="myText" value="" type="text" disabled/>
this works fine. But this does not work, the list is enabled ??
<select id="" disabled> <option></option> </select>
Please point me to any place that discuss these issues.
Regards!
Re: Urgent Help Please! Ajax Does Not Work in BB8900
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Flag for a Moderator
11-07-2009 10:45 AM
Can you post your javascript that is not working so that we can take a look at it??
Manager, Development Tools
Research In Motion
When diagnosing issues with BlackBerry Tools, it is always helpful to post your Operating System version (XP, Vista, Windows 7) and if it is 32 or 64bit
Re: Urgent Help Please! Ajax Does Not Work in BB8900
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Flag for a Moderator
11-07-2009 09:14 PM
Thanks for your replies. The following is my code.
loadlists.js:
var xmlhttp;
function initAjax() {
try {
if( window.XMLHttpRequest ) {
xmlhttp = new XMLHttpRequest();
} else if( window.ActiveXObject ) {
xmlhttp = new ActiveXObject( "Microsoft.XMLHTTP" );
}
} catch( e ) {
alert( "Error: " + e );
}
}
function refreshStrList(cityId) {
initAjax();
if (xmlhttp==null) {
alert ("Your browser does not support Ajax!");
return;
} else if(cityId == "") {
var strList = document.getElementById("strlist");
strList.length = 1;
return;
}
var url = ".../streets.jsp?cityId=" + cityId;
xmlhttp.onreadystatechange = cityStateChanged;
xmlhttp.open("GET", url, true);
xmlhttp.send(null);
}
function cityStateChanged() {
var strList = document.getElementById("strlist");
strList.length = 1;
var no = new Option();
if (xmlhttp.readyState==4 || xmlhttp.readyState=="complete") {
strLis.disabled = false;
var showdata = xmlhttp.responseText;
var strar = showdata.split("_$_");
// loop for filling the street list
}
}The JSP form:
<!-- .... -->
<form:form method="post" commandName="ereignis" name="myFrom">
<table border="0" id="mainTable">
<tbody id="mainTableBody">
<tr>
<td>City</td>
<td>
<form:select path="cityId" id="citylist" onchange="refreshStrList(this.value)">
<form:option value=""/>
<form:options items="${cities}" itemValue="id" itemLabel="name"/>
</form:select>
</td>
</tr>
<tr>
<td>Street</td>
<td>
<form:select path="streetId" id="strlist" disabled="true"> <!-- the list is always enabled even before changing the citylist value--> <form:option value="">---</form:option>
</form:select>
</td>
</tr>
</tbody>
</table>
</form:form>Problems:
1- while <form:input ... disabled="true"/> works fine, the above red code for disableing the combobox does not work, the lists are always enabled.
2- Ajax calls the servlet and the data is correctly loaded and I see that in the logger. But the data is not copied to the strList.
Thanks again for your time.
Re: Urgent Help Please! Ajax Does Not Work in BB8900
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Flag for a Moderator
11-08-2009 07:46 AM
Hi again,
I have changed the javascript code for filling the lists from
for(var i = 0; i < n; i++) {
strlist[i] = new Option(.., ..);
}
to:
for(var i = 0; i < n; i++) {
strlist.options[strlist.options.length] = new Option(.., ..);
}
And then in BB Simulator 9000, the list was filled out, but the mobile set BB 8900 still not working, the strlist is always empty.
The other problems still present in the simulator as well as the mobile set. E.g. list disable is not working, and DOM code for adding <tr> and <td> for the table do not work.
Thanks for any help
Re: Urgent Help Please! Ajax Does Not Work in BB8900
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Flag for a Moderator
11-08-2009 12:30 PM
Hi,
strangely, I could make it "more-or-less" work in the simulator as well as the BB 8900 device. The worked version uses:
strlist.options[strlist.options.length] = new Option("Text 1", "Value 1");??? I had to disable the javascript first, clear the cache, close the browser, open it again, enable the javascript and run the web application again. Since there was no Javascript Error when filling out the lists, DOM works fine.
I could not make drop-down lists "disabled", nevertheless, the list object has the property "disabled" set to true as the debugger showed? Somehow, I can live with that for a while :-)
Thanks for all..
Shortcut Navigation
Copyright © 2009 Research In Motion Limited, unless otherwise noted.





