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 Contributor
Posts: 7
Registered: ‎04-13-2012
My Device: 9900
My Carrier: Vodacom

WebWorks Form Not Submitting?

Hi Guys,

I have a problem where my basic form that I am using with jQuery isnt submitting.

 

For the purpose of this testing, I have this in my config:
<access uri ="*"/>

 

The form code as follows:

 

<script>
$(document).ready(function() {
    $('#loginForm').submit(function() {
        $.getJSON('http://my-server.tld/index.php?jsoncallback=?',
            {login_username: $('#login_username').val(), login_password: $('#login_password').val()},
            function(data) {
                if (data.success)    {
                    window.location.replace("dashboard.html");
                }
                else {
                    alert(data.message);
                }
            },'json');
        
        return false;
    });
});
</script>

<form action="#" name="loginForm" id="loginForm"> <table> <tr> <td colspan="2" align="center"><h1>Login Form</h1></td> </tr> <tr> <td align="right" width="100">Username:</td> <td><input name="login_username" type="text" id="login_username" x-blackberry-focusable="true" /></td> </tr> <tr> <td align="right">Password:</td> <td><input name="login_password" type="password" id="login_password" x-blackberry-focusable="true" /></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="button" id="button" class="button" value="Login" x-blackberry-focusable="true" /></td> </tr> </table> </form>

 

The form works fine in a normal browser as well as Ripple. However, using this app on a phone or a Simulator - doesnt work - its as if the form isnt trigerring the submit event.

New Contributor
Posts: 7
Registered: ‎04-13-2012
My Device: 9900
My Carrier: Vodacom

Re: WebWorks Form Not Submitting?

I just tried the following:

	$('#loginForm').submit(function() {
		alert('hi');
...

 and it did trigged/display the alert in the simulator - so I know it IS going into this event; but why is it not doing the getJSON code. Like I said, this works fine in Ripple and a normal browser...

New Contributor
Posts: 7
Registered: ‎04-13-2012
My Device: 9900
My Carrier: Vodacom

Re: WebWorks Form Not Submitting?

Ran further tests:

1) Used .ajax insted of .getJSON with same results

2) Loaded the webworks code directly in the BB browser and it works fine there; though in a 'packaged application' state, it doesnt - what the hell!?

Developer
Posts: 466
Registered: ‎04-11-2012
My Device: Bold 9900
My Carrier: Rogers

Re: WebWorks Form Not Submitting?

im relatively new here but i dont think the script language you are using is supported by BB OS did u try in chrome?


Developer for easyDial for BlackBerry Bold & inLink for BlackBerry PlayBook
Find me online via twitter, or on the techfruits.com webpage. Please hit the like button below if what I said helped!
New Contributor
Posts: 7
Registered: ‎04-13-2012
My Device: 9900
My Carrier: Vodacom

Re: WebWorks Form Not Submitting?

I havent tried in Chrome, but I have tried:

1) Internet Explorer: Works - even this god awful thing works with it.

2) FireFox: Works

3) Ripple: Works

4) BB Web Browser: Works

5) BB Simulator (9900): Fails

 

Its just as a packaged application that its not working.

 

Furthermore, Ive tried another method to do the same thing (just for testing):

$(document).ready(function() {
	jQuery.support.cors = true;

	$('#loginForm').submit(function() {
		$.ajax({
		  url: 'my-url.tld',
			data: {login_username: $('#login_username').val(), login_password: $('#login_password').val()},
			dataType: 'json',
		  success: function() {
		    alert('Load was performed.');
		  },
		  beforeSend: function () {
		    alert('before-send');
		  }
	}).done(function () {
		alert('done');
	});
	
	return false;
	});
});

 

I get the "before-send" message on the BB Simulator, but not the 'done' message. So its triggering, its just not doing anything after that.

Developer
Posts: 466
Registered: ‎04-11-2012
My Device: Bold 9900
My Carrier: Rogers

Re: WebWorks Form Not Submitting?

pretty certain then that ur script is not supported by bb os espeically bb os 7 browsers.. did you try playbook? bb os 7 browswers are pretty elementary in what it takes/does not take.


Developer for easyDial for BlackBerry Bold & inLink for BlackBerry PlayBook
Find me online via twitter, or on the techfruits.com webpage. Please hit the like button below if what I said helped!
New Contributor
Posts: 7
Registered: ‎04-13-2012
My Device: 9900
My Carrier: Vodacom

Re: WebWorks Form Not Submitting?

If BB OS6/7 doesnt support my script, then why does it work in their BROWSERS ?

I cant accept that.

 

I havent tried playbook - its not my target device; app is to work on Bolds.

 

IF you are right, and it doesnt support 'my script' - how else am I supposed to be submitting data to a remote server since everything Ive read up on says I should be using jquery/json?

Highlighted
New Contributor
Posts: 7
Registered: ‎04-13-2012
My Device: 9900
My Carrier: Vodacom

Re: WebWorks Form Not Submitting?

*bump* anyone?