Hi,
Is there a way to add the infomation in a url querystring/link to hidden form fields
and submit that form when the user clicks on the link?
Basically I have some paging links generated from a search page which hold a lot of search data and other variables. I need to send this data using the post method as its too much to be sent via the get method employed using a query string.
Any other technique to acheive the above would be appreciated as well. I've considered holding the data in session variables but if these could time out before the user has browsed through all their search results!
6 11446 acoder 16,027
Recognized Expert Moderator MVP
You should probably do this on the server-side, but you can use the search property. Parse it and set the hidden form values to the search values.
You should probably do this on the server-side, but you can use the search property. Parse it and set the hidden form values to the search values.
I dont understand what you mean by doing it on the server side? the paging links/numbers are generated dynamicaly and hold search data in the querystring. When the user clicks on the navigation link the data in that link is so long that the querystring get method will simply truncate. It therefore needs to be sent via the post method. The only way i can think of doin this is through javascript. the paging link would have a onclick even which sends it to a function that adds the search variables to a hidden form and then submits it.
How can you do that on the server side?
You should probably do this on the server-side, but you can use the search property. Parse it and set the hidden form values to the search values.
Ok I've come up with an idea. I could read all the variables in to one variable and then parse that at the other end. I have the following as example: - original query string:
-
-
"mysearchresults.asp?foo=blah&faa=blah&fee=blah&numperpage=10&pagenum=2"
-
-
myquery = "mysearchresults.asp?foo=blah&faa=blah&fee=blah&numperpage=10&pagenum=2"
-
-
new url string:
-
"mysearchresults.asp?query=myquery"
How do i parse the variable myquery into name value pairs in ASP?
acoder 16,027
Recognized Expert Moderator MVP
By doing it one the server-side, I meant dynamically generating from the server-side. If, however, you are using javascript, see the link I gave earlier. Parse the search string using string methods, e.g. split() which will split the string into an array (probably using "&" as a delimiter). Then get the form values and set them to the name-value pairs that you derive from the string.
By doing it one the server-side, I meant dynamically generating from the server-side. If, however, you are using javascript, see the link I gave earlier. Parse the search string using string methods, e.g. split() which will split the string into an array (probably using "&" as a delimiter). Then get the form values and set them to the name-value pairs that you derive from the string.
Ok i've found a script to parse the query string from a url however I get nothing in the parsed variable even thoug I know there is a value for that variable in the query string! Below is the code am using. any suggetions. Do I need to unescape the pair for it to work?
The url link is : "mysearchresult s.asp?fpage=1" generated dynamically - <script>
-
function getQueryVariable(variable) {
-
var query = window.location.search.substring(1);
-
var vars = query.split("&");
-
for (var i=0;i<vars.length;i++) {
-
var pair = vars[i].split("=");
-
if (pair[0] == variable) {
-
return pair[1];
-
}
-
}
-
alert('Query Variable ' + variable + ' not found');
-
}
-
</script>
acoder 16,027
Recognized Expert Moderator MVP Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Gowhera Hussain |
last post by:
Use This for Learning Only ....
Do Not Try To Act Smart
HACKING WITH JAVASCRIPT
Dr_aMado Sun, 11 Apr 2004 16:40:13 UTC
This tutorial is an overview of how javascript can be used to bypass
simple/advanced html forms and how it can be used to override cookie/session
|
by: Andy |
last post by:
Hi,
I am complete JavaScript novice and would really appreciate some help with
this code:
=====================================================================
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/ssdb.asp" -->
|
by: milkyway |
last post by:
Hello everyone,
I have a few values and variables that I want to post to a server
(without using a SUBMIT button). Is there a way to post data from
within javascript - do sockets or connections have to be open for this
to work?
Any help, hints or advice is appreciated :-)
Kindest Regards.
|
by: news.rcn.com |
last post by:
How can I access the request and response object for a page using
javascript. I want to stick some data on with something like
request.setAttribute( "User's choice for later use" ).
I can't seem to find a reference to request or response objects in
JavaScript either in Google Groups or O'Reilly's "JavaScript the Definitive
Guide" (surely it should be in the latter, huh?)
I know I could use a hidden form element but the data would be a...
|
by: VB Programmer |
last post by:
I have a javascript calculator. How do I pass the value of the calculator
result to another ASPX page so that I can right some VB.NET against the
value?
Thanks!
| |
by: Andy |
last post by:
Hi,
I have a complicated question that I'm hoping someone can help me out
with. I have a webpage that contains a plug-in. This plug-in can
communicate/pass data with the webpage that contains it via javascript.
What I need to be able to do is take that data passed via javascript
and, using vb.net as the code behind language, send it to a database
without posting it because when I post, the plugin is reloaded and
starts at the beginning....
|
by: =?Utf-8?B?QVRT?= |
last post by:
HOWTO Make CStr for JavaScript on ASP w/ Request.Form and QueryString
In ASP, Request.Form and Request.QueryString return objects that do not
support "toString", or any JavaScript string operation on parameters not
passed.
Example: Make a TST.asp and post to it as TST.asp?STATE=TEST
<%@ Language=JavaScript %>
<%
|
by: quirk |
last post by:
I am trying to write a script where a page is populated with some maths questions, user answers them (it's timed but I've left this bit out), gets results on same page and ajax takes their score, sends it to php script which updates sql. Make sense so far?!!
The problem I have is getting their score out of javascript and into ajax and therefore into the sql record table. I have no problem sending php variables to ajax, just the javascript...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |