You need to sign in to do that
Don't have an account?
Post a html form with Remote Function
Hi, i want to post a html FORM with remoteFunction (obtein the same result). Because i don't want that the page redirect to the action page (happend if i use the normal FORM), only i need to know the url of the result page. I think remoteFunction is the solution, because i can use onSuccess : function(response, request) { }.
I have something like this:
<form action="http://........../foo.aspx" method="post"> <input type="hidden" name="var1" value="value1"> <input type="hidden" name="var2" value="value2"> <input type="submit" value="submit"/> </form>
And i want to "translate" into some like this:
var actionFormUrl = 'https://................../foo.aspx'; var contentString = 'var1=value1&var2=value2'; var contentLength = String(contentString.length); sforce.connection.remoteFunction( { url :actionFormUrl, requestHeaders: {"Content-Type":"application/x-www-form-urlencoded", "Content-Length": contentLength, "SOAPAction": "\"\""}, method: "POST", mimeType: "text/xml", requestData: contentString, cache : true, async: false, onFailure : function fail(response, request) { alert('Error'); }, onSuccess : function(response, request) { alert('Success'); } });
My idea is on the onSuccess event get the url of the response (http://................./anotherPage.aspx?...............................................................), but the remoteFunction faild, the error is this:
<html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="https://......................./generic.aspx?..................................................." >here</a>.</h2> </body></html>
Any idea???
Thanks
Juan.