You need to sign in to do that
Don't have an account?
Shailesh Patel
fetch html form data in apex class with method POST
<html>
<body>
<h1>Show POST method Data</h1>
<form action="https://c50.visual.force.com/apex/TESTVFPAGE" method="POST" target="_top">
<br/><input type="text" name="name" id="id" value="POST MESSAGE"/>
<input type="submit" value="confirm"/>
</form>
<br/><br/>
</body>
</html>
How can we fetch this form data in apex class ,please guide us asap
Thanks in Advance
<body>
<h1>Show POST method Data</h1>
<form action="https://c50.visual.force.com/apex/TESTVFPAGE" method="POST" target="_top">
<br/><input type="text" name="name" id="id" value="POST MESSAGE"/>
<input type="submit" value="confirm"/>
</form>
<br/><br/>
</body>
</html>
How can we fetch this form data in apex class ,please guide us asap
Thanks in Advance
<Script>
function post(path, params, method) {
method = method || "post"; // Set method to post by default if not specified.
// The rest of this code assumes you are not using a library.
// It can be made less wordy if you use one.
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);
for(var key in params) {
if(params.hasOwnProperty(key)) {
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", key);
hiddenField.setAttribute("value", params[key]);
form.appendChild(hiddenField);
}
}
document.body.appendChild(form);
form.submit();
}
</Script>
<form action="https://shailesh9623-dev-ed--namespacess.ap1.visual.force.com/apex/testProxy" method="POST" target="_top" >
<input type="text" name="cxml-urlencoded" value="a">
<input type="text" name="param2" value="a">
<input type="submit" value="confirm" onclick=post(https://shailesh9623-dev-ed--namespacess.ap1.visual.force.com/apex/testProxy,params,"POST");/>
</form>
</html>
solution :- add javascript and create a site for apex class and vfpage