Is there any way to get response when using standardSubmit: true in extjs - extjs4.1

We are using extjs 4.1.2 . When we try to use standardSubmit: true ,form gets submitted,but not getting a response like "success/falure" (like in ajax) based on which i have to show a popup showing save success or fail . Is there any way to achieve this ??

Standard submit uses regular form post and is expected to arrive at a different page, not receive data. If you want to do AJAX post don't use standard submit.

Related

Visualforce dynamic components causing 'Not serializable' error on form submit

I have a visualforce page that uses a dynamic component to render some input fields. when a user hits the submit form button, I consistently receive a 'Not serializable: Component.apex.outputPanel' error.
Question is how best to use a dynamic component to render and bind some input fields so the record can then be submitted ? The variable I want to process on submit is declared in the page controller, but I cant get around the serialization error. Any suggestions most appreciated.
Cheers,
CH
Update:
this 'unable to submit a form while dynamic component rendered' remained a problem, so in the end I chose a different approach and whilst still used dynamic component, I avoided submitting the view state per standard salesforce approach, and instead submitted via a javascript remoting function that stringified all dynamic input fields client side, submitted to function which then parsed these out into a new sObject and performed DML. Done.

getJson method returns an error using woocommerce JSON API plugin

I'm using woocommerce JSON API to retrieve the data of some products like price, SKU, etc...
The thing is that I get an error using this API. I've installed the plugin succesfully and activated it in the WordPress Dashboard.
I've tried the example given in GitHub exactly as the author says.
Here's my javascript code:
$(document).on('pageinit','#restau' ,function(){
var url = 'http://danielvivancos.com/edu/wordpress/shop/?callback=?';
params = { action: 'woocommerce_json_api', proc:"get_products"};
params.arguments = {token: 1234, per_page: 2, page: 1}
jQuery.getJSON(url,params).done(function (data) {
alert("success");
console.log(data);
console.log(url);
}).error(function(jqXHR, textStatus, errorThrown){
alert(jqXHR.responseText);
});
});
At first it didn't do anything, and I didn't understand what was happening but then I added the .error() function and it threw me an error...
Here http://danielvivancos.com/edu/directebre_app_jquerymobile/ you will find the three alerts displayed when you click on any of the three products.
Hope someone can help me or give me some ideas to solve it.
Thank you all!
The API Almost always returns some kind of error string and error code. The one time when it wouldn't would be if there was a PHP error (Even then it tries to catch the error and return something).
One thing you may need to do is to visit the users settings page, setup your permissions, and then save the settings for that API User. Whenever a new method is added to the API you will have to visit this page and resave it.
Another thing to do is to try and run php tests/get_products.php and see what happens. Most of the API functions have a tests file that you can run from the command line to test the API.
Also, while I am very happy you are using it :) it is still unfinished and in the early stages of development.
It looks like your example is working though?
Could you post a bit more about what error you are getting?
When I click on one of the items, it takes me to a page where a popup shows up with a bunch of HTML, this normally means that your API page is not setup properly (if it is making an api request). You will need to setup the API page ( Just create a wordpress page, or use an existing one) Then in the WooCom menu select JSON Api, and set the API page from the dropdown list. Remember to save.

Would like to add some custom ajax & javascript to activeadmin based application

Hi guys I'm working on this application using activeadmin. I've come to a point where I would like to add in some ajax based functions. I have the basic form set up using teh activeadmin resource and it generates a very pretty form.
I would like to while the user is entering the details on the form - run a ajax call which would retrieve some html based on the values being entered and populate it on the page.
More likely I would like a way to add custom javascript to the page. Whats the best way to do this - I'm facing issues with returning html without the entire activeadmin layout coming with it.
You can use the /config/initializers/active_admin.rb
You can add javascript resources like this:
config.register_javascript 'my_functions.js'
I use to put code directly to /app/assets/javascripts/active_admin.js
You can also include script in /config/initializers/active_admin.rb

scrape the reponse which would be loaded from ajax event

I am using scrapy tool to scrape content from website, i need help from you guys how to scrape the reponse which is dynamically loaded from ajax.
when content loading from ajax at that mean time url not changing it keep remains same but content would be changed so on that event i need to crawl.
thank you,
G.kavirajan
yield FormRequest('http://addons.prestashop.com/en/modules/featureproduct/ajax-homefeatured.php',
formdata={'type':'new','ajax':'1'},
callback=self.your_callback_method)
bellow are the urls that you can easily catch using fiddler or firebug
this is for featured tab http://addons.prestashop.com/en/modules/featureproduct/ajax-homefeatured.php?ajax=1&type=random
this is for new tab http://addons.prestashop.com/en/modules/featureproduct/ajax-homefeatured.php?ajax=1&type=new
you can request on these url directly to get results you required, although website is using POST request to get data for these url, but i tried with parameter GET request is also working properly

POST a HTML Form programmatically?

I need to POST a HTML form to a 3rd party website (a Mass-SMS texting system).
In the past I've done this by forwarding to a page containing a form I've pre-populated and hidden (using display:none), then I've ran a javascript function at the end of the page to automatically submit this form.
However I'm hoping theres someway I can do all this programmatically (as I don't care about the response, and the user doesn't need to see the page the form is being posted to).
How can I do this? Cheers
You could use a WebClient.UploadValues method to send an HTTP POST request to a remote server from your code behind. Just fill up the name/value collection with the values coming from the hidden fields.
If you're willing to get into PHP, you can very easily use cURL for this.
Otherwise it's going to be quite difficult using just Javascript.
See here for a detailed tutorial.