9 Replies Latest reply on Dec 1, 2015 3:01 AM by Mark Nongkhlaw

    Please help : App exits after submitting a form!

    Mark Nongkhlaw

      Surprisingly, the app exits after submitting a form instead of displaying the params. This is extracted from the system-api-samples app. Tested in RMS 5.1.1. Please help.

       

      This is the form :

       

      <div data-role="page">

       

       

        <div data-role="header" data-position="inline">

          <h1>Form test</h1>

        </div>

       

       

        <div data-role="content">

       

       

          <form method="POST" action="<%= url_for :action => :do_submit %>">

              <% if get_msg() %>

                <p style="color: red"><%= get_msg() %></p>

              <% end %>

       

       

              <div data-role="fieldcontain">

                <label for="login" class="fieldLabel">Login</label>

                <input type="text" name="login" <%= placeholder("Login") %> />

              </div>

             

              <div data-role="fieldcontain">

                <label for="password" class="fieldLabel">Password</label>

                <input type="password" name="password" <%= placeholder("Password") %> />

              </div>

             

              <div data-role="fieldcontain">

                <label for="record[value]">Value1</label>

                <input type="radio" name="record[value]" value="Value1" />

              </div>

              <div data-role="fieldcontain">

                <label for="record[value]">Value2</label>

                <input type="radio" name="record[value]"  value="Value2" />

              </div>

             

              <div data-role="fieldcontain">

                <label for="number" class="fieldLabel">Enter number</label>

                <input type="number" name="number_field"/>

              </div>

             

              <input type="submit" class="standardButton" value="Login"/>

          </form>

       

       

        </div>

       

       

      </div>

       

      And this is the controller code :

       

      require 'rho'

      require 'rho/rhocontroller'

      require 'rho/rhoerror'

      require 'helpers/browser_helper'

       

       

      class JQueryMobileTestController < Rho::RhoController

        @layout = 'JQueryMobileTest/layout'

        include BrowserHelper

        @@msg = ""

       

       

        def index

          render :back => '/app'

        end

       

       

        def get_msg

        @@msg

        end

       

       

        def do_submit

          @@msg = @params

          redirect :action => :index

        end

       

       

      end

        • Re: Please help : App exits after submitting a form!
          Mark Nongkhlaw

          Looks like @params returns nothing!

          Has the syntax changed from earlier versions?

          If yes, how do you now access the values posted by a form?

            • Re: Please help : App exits after submitting a form!
              Joydeep Chakraborty

              Hi Mark,

              What is the OS and device you are trying on?

              Regards,

              Joydeep

                • Re: Please help : App exits after submitting a form!
                  Mark Nongkhlaw

                  Not tested on device yet. Only Chrome and Rhosimulator. Tried RMS 5.2.2 also. Same problem. Wiered.

                    • Re: Please help : App exits after submitting a form!
                      BHAKTA RANJAN SATAPATHY

                      Crash is happening because of Jquery Mobile.

                      Do you need to use Jquery Mobile in your application?

                       

                      If you remove JQuery Mobile, Application will not crash.

                       

                      Thanks

                        • Re: Please help : App exits after submitting a form!
                          Mark Nongkhlaw

                          Yes, I'm using Jquery mobile. I was under the impression that it is supported in Rho, or has support for it stopped. If yes, since which version of Rhodes? Incidentally, when I use Rhodes 3.3.2 (yes, that's rather old), same app runs fine both in Rhosim and device (tested on Android)

                            • Re: Please help : App exits after submitting a form!
                              BHAKTA RANJAN SATAPATHY

                              Hello Mark,

                               

                              We are looking to the crashing issue. Mean while to test your UI, just launch rhosimulator. Then take the address and port of the local server, and launch it on Google Chrome browser.

                               

                              Thanks

                              Bhakta

                                • Re: Please help : App exits after submitting a form!
                                  Mark Nongkhlaw

                                  I just tested it in Chrome browser and it works fine there. Please see inserted screenshot. Could it be a problem with Rhosimulator? To aid you in further investigation, I am including here-under the contents of layout.erb referred to in my controller above (@layout = 'JQueryMobileTest/layout') :

                                   

                                  <!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>JQueryMobileTest</title>

                                   

                                   

                                      <% is_bb6 = System::get_property('platform') == 'Blackberry' && (System::get_property('os_version').split('.')[0].to_i >= 6) %>

                                   

                                   

                                      <% if is_bb6 %>

                                          <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>

                                      <% else %>

                                          <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>

                                      <% end %>

                                   

                                   

                                      <% if System::get_property('platform') == 'WP7' %>

                                          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

                                      <% end %>

                                   

                                   

                                      <% if System::get_property('platform') == 'APPLE' || System::get_property('platform') == 'ANDROID' || is_bb6 || System::get_property('webview_framework') =~ /^WEBKIT/ %>

                                          <script src="/public/jquery/jquery-1.6.4.min.js" type="text/javascript"></script>

                                   

                                   

                                          <link rel="stylesheet" href="/public/jqmobile/jquery.mobile-1.0.css">

                                          <link rel="stylesheet" href="/public/css/jqmobile-patch.css">

                                          <% if System::get_property('platform') == 'APPLE' %>

                                              <link href="/public/jqmobile/jquery-mobile-iphone.css" type="text/css" rel="stylesheet"/>

                                          <% end %>

                                   

                                   

                                          <!-- Set parameter below to non-zero value if you would like

                                               to have endless scroll feature for index.erb files -->

                                          <% $pagesize = 0 %>

                                   

                                   

                                          <script type="text/javascript">

                                              $(document).bind("mobileinit", function(){

                                                  // jQuery-Mobile init options initialization goes here. For example, you may

                                                  // enable automatically generated 'Back' buttons on headers this way:

                                                  //$.mobile.page.prototype.options.addBackBtn = true;

                                   

                                   

                                                  // You can disable (with false value) or change page loading message

                                                  $.mobile.loadingMessage = false;

                                                  //$.mobile.loadingMessage = "loading"; // it is default value

                                   

                                   

                                                  // For documented init options look here:

                                                  // http://jquerymobile.com/demos/1.0/docs/api/globalconfig.html

                                   

                                   

                                                  // For poorly documented options search for ".prototype.options"

                                                  // in the jQuery Mobile source code

                                   

                                   

                                                  // Rhodes custom option!

                                                  // how long to wait transition end before "loading.." message will be shown

                                                  $.mobile.loadingMessageDelay = 300; // in ms

                                   

                                   

                                                  // Uncomment these options in case of performance problem in pages transition

                                                  //$.mobile.defaultPageTransition = 'none';

                                                  //$.mobile.defaultDialogTransition = 'none';

                                                  //$.mobile.ajaxEnabled = false;

                                                  //$.mobile.pushStateEnabled = false;

                                                  //$.mobile.loadingMessageDelay = 50; // in ms

                                              });

                                          </script>

                                          <script type="text/javascript" charset="utf-8" src="/public/jqmobile/jquery.mobile-1.0.min.js"></script>

                                          <script type="text/javascript" charset="utf-8" src="/public/js/jqmobile-patch.js"></script>

                                          <% if $pagesize > 0 %>

                                              <script type="text/javascript" charset="utf-8" src="/public/js/jquery.endless-scroll.js"></script>

                                          <% end %>

                                   

                                   

                                      <% end %>

                                   

                                   

                                      <% if System::get_property('platform') == 'APPLE' %>

                                          <link href="/public/css/iphone.css" type="text/css" rel="stylesheet"/>

                                      <% elsif System::get_property('platform') == 'ANDROID' %>

                                          <link href="/public/css/android.css" type="text/css" rel="stylesheet"/>

                                      <% elsif is_bb6 %>

                                          <link href="/public/css/android.css" type="text/css" rel="stylesheet"/>

                                      <% elsif System::get_property('platform') == 'Blackberry' %>

                                          <link href="/public/css/blackberry.css" type="text/css" rel="stylesheet"/>

                                      <% elsif System::get_property('platform') == 'WP7' %>

                                       <link href="/public/css/windows_mobile.css" type="text/css" rel="stylesheet"/>

                                    <script src="/public/js/wp7.js" type="text/javascript"></script>

                                      <% elsif System::get_property('webview_framework') =~ /^WEBKIT/ %>

                                          <link href="/public/css/android.css" type="text/css" rel="stylesheet"/>

                                      <% elsif System::get_property('platform') == 'WINDOWS' %>

                                       <link href="/public/css/windows_mobile.css" type="text/css" rel="stylesheet"/>

                                      <% end %>

                                  </head>

                                   

                                   

                                  <body

                                  <% if is_bb6 %>

                                    data-do-fix-forms="true"

                                  <% elsif System::get_property('platform') == 'WP7'%>

                                    onload="wp7_change_forms_action_to_get()"

                                  <% end %>

                                    >

                                      <%= @content %>

                                  </body>

                                   

                                   

                                  </html>Untitled.png