Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Developer
Posts: 3
Registered: ‎10-16-2009
My Device: Not Specified
Accepted Solution

location.replace doesn't go to the page specified in the BlackBerry Browser

I have a website that contains a database of bands and venues. Wesbite visitors can search the database and see the schedule of when and where a band is playing. The search results can be filtered based upon one or more search criteria (band name, musical genre, venue name, city, etc). http://atlbands.com

 

I decided that I would make a mobile device friendly version of the search page. This page is stripped down to the bare bones. I got rid of all the images and a pop-up calendar. The search page contains a number of HTML SELECT dropdowns, which are populated via php/mysql. After making the desired selections, a submit button calls a javascript function which produces a URL and uses location.replace to redirect to a new page.

 

The new page takes the parameters, performs a query and returns a list of the matching schedules. The page works as expected in IE and Firefox, as well as on an iPhone. It does not work on a BlackBerry. I utilized the BB Simulater and I can see what is happening.

 

The search page is http://atlbands.com/msearch.php 

 

An example of a URL that might be generated on this page is

 

http://atlbands.com/mresults.php?band=&genre=&venue=North%20River%20Tavern&city=&zipcode=&county=&da...

 

What is strange is that on the BB, this URL is generated

 

http://atlbands.com/msearch.php?band=&genre=&venue=North%20River%20Tavern&city=&zipcode=&county=&day...

 

As you can see, the URL is pointing to tthe msearch.php page and not the mresults.php page. Of course this page doesn't expect any parameters, so the user simply sees the page reset, with all of their selections removed.

 

I tried to use location.href and location.assign but these do the same thing. The funny thing is that the regular search page works on the BB (albeit it isn't very easy to navigate on a mobile device).  The difference there is that the search and results page are the same page. For the results of a search using a small BB screen, I wanted to utlize all available space to dispaly the results and not take up any space redisplaying the SELECT options.

 

Is there a known issue regarding page redirect on the BB, or have I made some coding error?

 

TIA

 

Dave

atlbands.com

 

 

 

Developer
Posts: 189
Registered: ‎08-13-2008
My Device: Not Specified

Re: location.replace doesn't go to the page specified in the BlackBerry Browser

Hello I've had problems with javascript redirects in the past.

 

I always use document.location.href = URL; now as I found this works for all simulators I tested it on.

 

Let me know how you get on, if it fails I'll have another look.

 

cheers

 

Andrew

Developer
Posts: 189
Registered: ‎08-13-2008
My Device: Not Specified

Re: location.replace doesn't go to the page specified in the BlackBerry Browser

Hello again.

 

I'm not so sure its a redirect issue check out the javascript in the test page. I changed a few things but I think its the way the form was accessed.

 

It works for me on simulator I tested it on - 8900 v4.6.1.109

 

band test

Developer
Posts: 107
Registered: ‎09-25-2008
My Device: Not Specified

Re: location.replace doesn't go to the page specified in the BlackBerry Browser

Is there any reason you're using javascript to do the form submission? What's the purpose of creating a form, and then using javascript to replication functionality that the form gives you for free? All you need to do is set action="mresults.php" on your form and change your button onclick to an input type=submit you're good to go. Forget the javascript.

New Developer
Posts: 3
Registered: ‎10-16-2009
My Device: Not Specified

Re: location.replace doesn't go to the page specified in the BlackBerry Browser

Is there any reason you're using javascript to do the form submission?

 

Well, there certainly was no good reason. You are correct, using the standard post method is all that is required in this sceario, and resolves my problem. Thanks so much for your help. I renamed the page to http://atlbands.com/mobile.php

New Developer
Posts: 3
Registered: ‎10-16-2009
My Device: Not Specified

Re: location.replace doesn't go to the page specified in the BlackBerry Browser

Thanks for your effort to help. I took the advice of stacktrace and ditched the unnecessary javascript.