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
Contributor
HarrietNY
Posts: 22
Registered: ‎01-20-2011
My Device: Bold 9650
Accepted Solution

Offline Form Submission not working when Wifi is turned off

I'm trying to set up a simple form that is available to users when online or offline.

I have two files saved in the same folder on my server

      simpleEntryForm.htm

submits data to:

      testSQL5.php

 

I can submit from .htm to .php when I am connected to Wifi, but when I turn off my Wifi Connection, I get the message :

"Cannot visit web page when radio is turned off.  Please turn the radio on and try again."

 

Does the page I submit to have to be .asp or can it be a .php page?

 

I made sure to visit the page and submit the form data from the .htm to the .php first with internet access successfully before attempting it offline.

 

I need it to work on Blackberries with OS 5 and OS6

 

I have the hidden fields in my simpleEntryForm.htm page:

<input type="hidden" name="x-rim-queue-id" value="MyOfflineQueue" />
<input type="hidden" name="x-rim-request-title" value="My Form Submission" />

 

In fact, here is the entire simpleEntryForm.htm (Can anyone see what I am doing wrong?):

 

 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>MyMTA</title>
  <link href="Styles/styles.css" rel="stylesheet" type="text/css" />


 </head>
 <body">


YOU ARE NOW ON V-NOLITA SERVER


<form id="MTAForm" name="MTAForm" method="post" enctype="multipart/form-data" action="http://38.96.130.170/comnet/testSQL5.php" onsubmit="return validateForm();">


<input type="hidden" name="x-rim-queue-id" value="MyOfflineQueue" />
<input type="hidden" name="x-rim-request-title" value="My Form Submission" />


<input type="hidden" name="username" value="hg@mtahq.org" />
<input type="hidden" name="password" value="offline simple test" />

<table width = "95%">

   <tr>
      <td style="width:95%">Submission Type:<br>
      <select name="problem" id="problem" STYLE="width: 400px" >
             <option value="">Select Type</option>
             <option value="Simulator">Simulator</option>
             <option value="Actual device">Actual device</option>
             <option value="Browser">Browser</option>
             <option value="Browser of Actual Device">Browser of Actual Device</option>
             <option value="Browser of Simulator">Browser of Simulator</option>

          </select>
      </td>
   </tr>
  <tr>
      <td style="width:95%">Online or Offline?<br>
      <select name="problem_detail" id="problem_detail" STYLE="width: 400px" >
             <option value="">Select Access</option>
             <option value="Online">Online</option>
             <option value="Offline">Offline</option>

          </select>
      </td>
   </tr>

   <tr>
      <td style="width:95%">
    <!-- MAX_FILE_SIZE must precede the file input field -->
    <input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
    <!-- Name of input element determines name in $_FILES array -->
    Image: <input name="userfile" type="file" />

 

      </td>
   </tr>

  <tr>
      <td style="width:95%">OS:<br>
      <select name="borough" id="borough" STYLE="width: 400px" >
             <option value="">Select OS</option>
             <option value="5">5</option>
             <option value="6">6</option>

          </select>
      </td>
   </tr>
  <tr>
      <td style="width:95%">Subway Line:<br>
      <input name="subwayline" id ="subwayline" type="text" value="testing - subwayline"  style="width:400px" >
      </td>
   </tr>
  <tr>
      <td style="width:95%">Station:<br>
      <input name="station" id ="station" type="text" value="testing-station"  style="width:400px" >
      </td>
   </tr>
  <tr>
      <td style="width:95%">Location:<br>
      <input name="location" id ="location" type="text" value="testing-location"  style="width:400px" >
      </td>
   </tr>
  <tr>
      <td style="width:95%">Details on problem/location (optional):<br>
      <input name="comments" id ="comments" type="text" value="simple offline data entry form"  style="width:400px" >
      </td>
   </tr>


</table>
<input type="submit" value="Submit" />


</form>

 

 </body>
</html>


 

Thanks!!

Please use plain text.
Contributor
HarrietNY
Posts: 22
Registered: ‎01-20-2011
My Device: Bold 9650

Re: Offline Form Submission not working when Wifi is turned off

Never mind - I tried it on a co-workers blackberry and it worked.  I'm not sure why it does not work on the first blackberry I tried.  That one has no phone/data plan, just connects via Wifi.  Maybe that is why.

So, ignore this post.

Thanks

Please use plain text.
Developer
abarber
Posts: 189
Registered: ‎08-13-2008
My Device: Not Specified

Re: Offline Form Submission not working when Wifi is turned off

Hi

 

Just note that there is no Backberry offline queue functionality in OS6. So it will not submit offline on a Blackberry 6 or above device.

 

Blackberry removed this functionality after OS5.

 

cheers

 

Andrew

Please use plain text.
Contributor
TheSource
Posts: 14
Registered: ‎09-04-2011
My Device: BlackBerry Bold 9700 + PlayBook

Re: Offline Form Submission not working when Wifi is turned off

Wouldn't the better option here be to some check to

 

a) see if any connection type is available

b) if yes then send data

c) if no then save to a local DB

d) provide a SYNC button option to send data to the server once condition "a" and 'b' is true.

 

 

Please use plain text.
Contributor
HarrietNY
Posts: 22
Registered: ‎01-20-2011
My Device: Bold 9650

Re: Offline Form Submission not working when Wifi is turned off

Thanks

Yes, TheSource - I will have to do it that way (although I will be detecting and submitting in the background - my client does not want to have to sync).  Unfortunately offline queuing does not work with OS 6  (Thanks to abarber for letting me know that).  Offline Queuing would have been an easier option for me if it worked with OS 6.

 

 

Please use plain text.
Contributor
HarrietNY
Posts: 22
Registered: ‎01-20-2011
My Device: Bold 9650

Re: Offline Form Submission not working when Wifi is turned off

Thanks

Please use plain text.
Developer
abarber
Posts: 189
Registered: ‎08-13-2008
My Device: Not Specified

Re: Offline Form Submission not working when Wifi is turned off

If you want to completly replicate the offline queue functionality on the BB6 and 5, you are going to need to write a java extension, that your webkit app hooks into, its the only way to be truly in the background.

 

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Using-JavaScript-Extensions-in-y...

 

Cheers

 

Andrew

 

 

Please use plain text.
Contributor
HarrietNY
Posts: 22
Registered: ‎01-20-2011
My Device: Bold 9650

Re: Offline Form Submission not working when Wifi is turned off

[ Edited ]

I was going to use this in the config:

<content>

   <rim:background src="listener.html" runOnStartup="true" />

</content>

 

I tried a sample webworks app that checks for internet access every half hour and it seems to be working well in the background with this method.  It starts on startup of the device and it was working when the user regains internet access.

 

What is the difference between doing it this way vs. doing the javascript extension?

Thanks for all your help.

-Harriet

Please use plain text.