Loading ...
Sorry, an error occurred while loading the content.

My AsyncRequest Failling In Opera !!

Expand Messages
  • chaluwa
    This a script block from the login module of my application, it works well in firefox and IE7 but fails in opera, here I am trying to send the username and
    Message 1 of 3 , Feb 28, 2008
    • 0 Attachment
      This a script block from the login module of my application, it works
      well in firefox and IE7 but fails in opera, here I am trying to send
      the username and password entries in the login form to 'server_LINK',
      the success function of the callback object uses 'json' to parse the
      JSON response, checks that all was well (status == 200) and redirects
      the user to the application console.

      var handleLogin = function (form){
      var oCallback = {
      success: function(o){
      var response = json.fromJsonStr(o.responseText);
      if(response.entry.status == 200){
      location.href = 'console.php?port=' + response.entry.port;
      }else{
      YHUB.widget.QuickUI.callout(
      {
      title:'Invalid Login',
      body:'Authentication Failed',
      attachee:form.usr.id
      }
      );
      }
      },
      failure: function(o){
      YHUB.widget.QuickUI.alert(server_NA);
      }
      }
      connect.setForm(form);
      connect.asyncRequest('POST', server_LINK, oCallback, 'mode=login');
      };

      Don't worry about my variables (they have been declared), when the
      enter key is hit (I listen for this event), Opera just appends the
      form's entries to the browser's address bar as if a traditional GET
      request was made with a HTML form.

      I am actually trying to test my YUI application in opera, using it's
      small screen view to see if and how it works in a constrained device
      like a mobile phone, which brings me to the big question ....

      How does YUI (and AJAX in general) scale on handheld devices, not just
      iPhone (which is rarely used in my country as at now). I tried to test
      this by running some of YUI's examples using opera's small screen view
      and wasn't quite pleased.

      Finally, are there (better) tools for testing AJAX apps for handheld
      devices, also are there standards.

      Suggestions Please.
      Thanks.
    • tssha
      ... ... How is handleLogin() called? What you re describing in Opera suggests the submit event is propagating to the form. Are you stopping the
      Message 2 of 3 , Feb 28, 2008
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, "chaluwa" <chaluwa@...> wrote:
        >

        <snip>

        > Don't worry about my variables (they have been declared), when the
        > enter key is hit (I listen for this event), Opera just appends the
        > form's entries to the browser's address bar as if a traditional GET
        > request was made with a HTML form.

        How is handleLogin() called? What you're describing in Opera suggests
        the "submit" event is propagating to the form. Are you stopping the
        event's propagation with YAHOO.util.Event.stopPropagation(), or
        stopping the event altogether with YAHOO.util.Event.stopEvent()?

        Regards,
        Thomas
      • chaluwa
        This is the flow of my login module: // this is within my namespace, and am using the module pattern // handles have been defined at point var isEnterKey =
        Message 3 of 3 , Mar 1, 2008
        • 0 Attachment
          This is the flow of my login module:

          // this is within my namespace, and am using the module pattern
          // handles have been defined at point
          var isEnterKey = function(e){
          // inspect event and return true only if the enter key was pressed
          }

          var handleLogin = function(form){
          // as defined in my early post.
          // makes an asyncronous request to the server
          // with input of the passed form
          // if all went well, redirect the user
          }

          var doLogin = function(e){
          if( isEnterKey(e) ){
          var form = evt.getTarget(e).form;
          // YHUB is my hub of utilities for yui, YHUB.util.Forms
          // manages form related issues.
          // this is where handleLogin gets called, but only if
          // required fields have been filled with data and validated
          // handleLogin gets called with the value of the frm property
          // of the config object passed as the parameter to this call.
          // it is actually the form we declared just above.
          YHUB.util.Forms.checkFields(e,{frm:form, handler: handleLogin});
          }
          };

          // then we attach events to the input fields
          // evt is a handle for YAHOO.util.Event
          evt.addListener(dom.get('usr'), 'keydown', doLogin);
          evt.addListener(dom.get('pswd'), 'keydown',doLogin);

          // end of code block
          The form in the markup has no submit button (for firing submit
          events), just two input fields which I attach event listeners to, and
          send their entries to the server after some checking.
          I'll however try the stopEvent suggestion you made.

          Thanks.
        Your message has been successfully submitted and would be delivered to recipients shortly.