+ Start a Discussion
DipakDipak 

How can get URL param values at Apex Controller during POST method?

Hi,

 =================================================== 
<form action="/SaveObjectInformation" method="GET">
<input type=hidden name="oid" value="00D90000000atAnEAI"/>
<input type=hidden name="UniqueNo" id="UniqueNo" value="1"/>
<input type=hidden name="retURL" id="retURL" value="http://"/>
 
<input id="firstname" maxlength="40" name="firstname" size="20" type="text" />
<input id="email" maxlength="40" name="email" size="20" type="text" />
<input id="company" maxlength="40" name="company" size="20" type="text" />
<input id="lastname" maxlength="40" name="lastname" size="20" type="text" />
<input type="submit" name="submit"></form>      

==============================================================
This is HTML code of a form page. At submit button I need to save record at an Object.

Form action containes OurOwnVF page ,thus calls own Apex Controller.
Something same like WebToLead thing we are trying.


Now if form action method =GET, then easily I can get param name and param value from URL after clicked submit .
After click it goes to SaveObjectInformation page  with parameters and at Apex class of that page get URL param value by System.currentPagereference .
================
String uniqueParamValue = System.currentPageReference().getParameters().get('UniqueNo');
=======================
URL param names are input fields name and value are respective to them.
So then insert at object.



But problem is that for method=POST  System.currentPageReference().getParameters().get('UniqueNo'); returns NULL

How can get URL param values at Apex Controller during POST method
?



Please help .I am stuck in this problem.
Thanks in advance

jd123jd123

Hi

 

write in apex calss 

   public String Name{set;get;}

DipakDipak

Hi

I didn't get your answer.. I think you didn't understand the issue in my above code

1- When I am using method=GET , i.e <form action="/SaveObjectInformation" method="GET">

                                                                                  <input type=hidden name="UniqueNo" id="UniqueNo" value="1"/>

                                                                                  <input type="submit" name="submit">

                                                                      </form>    
  in apex controller System.currentPageReference().getParameters().get('UniqueNo'); returns correct value.


2-
But IfI am using method=POST i.e <form action="/SaveObjectInformation" method="POST">

                                                                                  <input type=hidden name="UniqueNo" id="UniqueNo" value="1"/>

                                                                                  <input type="submit" name="submit">

                                                                      </form>  

 in apex controller System.currentPageReference().getParameters().get('UniqueNo'); returns NULL.

 

So i' like to know about the process, to get input field value during POST method