You need to sign in to do that
Don't have an account?
RICIT
Submit HTML Form
Hello. I need to replicatethe functionality of:
<body onload="document.getElementById('form').submit()>
<form id="form" method="post" action="http://localhost/Salesforce/testphp.php">
...(inputs with field data from salesforce)...
</form>
</body>
in a Visualforce Page.
Thank you!
If you page uses the standard SF header, the body tag is ignored.
There are 2 ways to accomplish this.
1. set showHeader to false
<apex:page showHeader="false"> <body onload="alert('hi');"> 1234 </body> </apex:page>
2. move the javascript call from onload to the end of the page
<apex:page> <script> <!-- put this at the end of the page --> alert('hi'); </script> </apex:page>
All Answers
There is no reason why you can't have that.
The onload handler might give you some problems - I have read on the boards that it is not always reliable, though where I've used it to date it has been.
You can populate the value of the inputs with values from SalesForce using property values from your controller or field values from sObjects.
You can mix and match HTML with VisualForce components, so there will be no problem embedding that form.
Thank you for your quick response.
I am indeed getting issues with the onload handler; it is not functioning. The page loads and just sits there, instead of submitting the form. Ideas?
Thanks again.
If you page uses the standard SF header, the body tag is ignored.
There are 2 ways to accomplish this.
1. set showHeader to false
<apex:page showHeader="false"> <body onload="alert('hi');"> 1234 </body> </apex:page>
2. move the javascript call from onload to the end of the page
<apex:page> <script> <!-- put this at the end of the page --> alert('hi'); </script> </apex:page>
Great! First one worked like a charm!
Thank you.