PDA

View Full Version : Error in Form submission - url is invalid



singh.bk
17 Oct 2011, 6:56 AM
I am trying to submit a form and I get an url is invalid error.

Following is the code that I have used in my js file

Ext.onReady(function(){
var simple = new Ext.form.FormPanel({
standardSubmit: true,
frame:true,
title: 'Login',
width: 350,
defaults: {width: 230},
defaultType: 'textfield',
items: [{
fieldLabel: 'Username',
name: 'username',
allowBlank:false
},
{
fieldLabel: 'Password',
name: 'password',
allowBlank:false
}

],
buttons: [{
text: 'Submit',
handler: function() {
simple.getForm().getEl().dom.action = 'http://www.yahoo.com';
simple.getForm().getEl().dom.method = 'POST';
simple.getForm().submit();
}
}]
});
simple.render('mytraditionalform');
});

When I try to run the app, I get the following error on click of submit

"The Page could not be opened because the url is invalid(http://www.yahoo.com)"

Thanks in advance

singh.bk
17 Oct 2011, 10:47 PM
Can somebody please help me in debugging this issue

Thanks

netemp
17 Oct 2011, 10:55 PM
Is there any particular reason behind using the following:


simple.getForm().getEl().dom.action = 'http://www.yahoo.com';
simple.getForm().getEl().dom.method = 'POST';
simple.getForm().submit();

I shall suggest you to try using url: config in the form. That should surely work.

Hope this helps.

singh.bk
18 Oct 2011, 9:43 AM
Thanks for the reply.
I tried using url: config as well but I get the same error.

I would like to add that the form is working fine if I load it from the browser. However its giving an error in the simulator. Am I missing any plugin?

Appreciate any kind of response.

arthurakay
18 Oct 2011, 1:26 PM
I would like to add that the form is working fine if I load it from the browser. However its giving an error in the simulator. Am I missing any plugin?

So it works fine in the browser... great.

What simulator are you talking about?

singh.bk
18 Oct 2011, 9:47 PM
Thanks for the reply
I use the Android Emulator

arthurakay
19 Oct 2011, 6:23 AM
I use the Android Emulator

ExtJS isn't going to work as expected unless it's loaded into a browser. If you're running your app through an emulator, it isn't going to behave the same.

I'm guessing that you want some sort of native mobile app? If that's the case, you should look into PhoneGap - but you'll be better off building your app in Sencha Touch.

singh.bk
19 Oct 2011, 6:52 AM
Thanks for the info Arthur

I am indeed looking to build a native phone app, but I was advised to use Sencha as it has a wonderful css. I have faced no problems in phonegap and was wondering why sencha is not working!!

Thanks for the info. Appreciate your response

arthurakay
19 Oct 2011, 6:56 AM
To clarify, PhoneGap is a product that wraps your web application (written in Sencha Touch, or something else... I suppose ExtJS would work to some degree) and spits out a native mobile app.

So, in theory, you can write your app in ExtJS, then run it through PhoneGap and you'll have your mobile app. But as I said, you may want to use Sencha Touch.