passing parameters problem.

seductive

Member
hi i have a problem a about passing parameters i have more than 5000 character and i dont know how to pass it.. url have a limit with 2000 char only..
 
Ok, I should ask why you need that many and or big paramters. I think you need to review your code and design.

But I suggest using POST method for forms and not GET.

Regards,

Casper.
 
Thanks for the reply sir casper.

im only new in programming sir. i dont have any idea. can you give me a sample code using post. im using ajax to pass those parameter. im working a registration form. i have lots of data entry to pass and save. thank you so much again sir.
 
thanks for answering my question guys. im using the GET method.
because in GET method i can catch the parameter using GET-VALUE("parameter").
how about the POST how can i catch the parameter?
 
in GET method i can catch the parameter using GET-VALUE("parameter").
how about the POST how can i catch the parameter?

same way, progress webspeed api does not differentiate between POST/GET parameters and beside that using get-value not only check for input fields (form fields for POST, query string parameters for GET) but also for user fields or cookies... while user-fields are not very much used cookies might be something that you'll want to use at some point so be aware of that behavior of get-value function.
 
hmm, maybe i didn't make it very clear... you can either stick to using get-value('field') as you do now do nothing changes if it's a POST or GET, or you can use get-field('field') instead of get-value api to avoid all cookies that might have been set.
 
sir i have a sample code. i really dont get it.. im really confused.. huhuhu...

this is my main page..
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script language="javascript">

function passParam(){
var url = "secondpage.html";
http.open("POST", url, true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
http.send(null);
}

</script>
</head>
<body>
<form method="">
<input type="text" value="sample1" id="id1">
<input type="text" value="sample2" id="id2">
<input type="text" value="sample3" id="id3">

<input type="button" value="Go" onclick="passParam()">
</form>
</body>
</html>


this is my secondpage named secondpage.html.
i dont know how to get the value of my textbox 3.
<script language="speedscript">
GET-VALUE("id3")
</script>

what is wrong?? huhuhuhu.. :((
 
well, if you pass 'null' to send then you sure won't get any parameter on the other side :)

normally a form will send all it's input parameters when submitted but this is not your case as you don't use regular form submit but an ajax call... you need to pass through all form's input fields and build up the parameter list to be sent

try something like this...

Code:
function passParam() {
   var url = "secondpage.html";
   var params=''; 

   // build param list from all input fields from the same form as the submit button 
   for (i=0; i<this.form.elements.length; i++) {
     var fld=this.form.elements[i];
     params += fld.name + '=' + fld.value + '&'; 
   }
   params=params.substring(1, params.length-1);

   http.open("POST", url, true);
   http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   http.setRequestHeader("Content-length", params.length);
   http.setRequestHeader("Connection", "close");
   http.onreadystatechange = function() {
      if(http.readyState == 4 && http.status == 200) {
         alert(http.responseText);
      }
   }
   
   http.send(params);
}
 
so its null. hehe, sorry about that. now i know.. :D

thanks for the code. i try using the get-value i cannot catch anything in my secondpage..
 
looks like i've missed the fact that you use ids instead of names for input fields...

try to change fld.name to fld.id: params += fld.id + '=' + fld.value + '&';
 
yehey its working. im so happy.. :biggrin:
thank you so much medu.

if theres a limit in this code? or character limit?
like the GET method its accept only less than 2000 character?
 
if theres a limit in this code? or character limit?
like the GET method its accept only less than 2000 character?

no limit enforced by http specification, however most http servers allows one to set such a limit... for Apache for instance there is the 'LimitRequestBody' directive (default is 0, unlimited).
 
Back
Top