473,748 Members | 10,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Removing values from querystring before being sent through form (get method)?

Just wondeing if there is a way to keep from having a certain
parameter sent when posting a form to another page (method=get)...

So as an example a page will post something like this from a form
using "get":

http://mypage?firstElement=1&secondElement=2

How can you completely remove "secondElement= 2" from the
querystring... Before moving on to the posted page?

I know you can actually remove the element using removeChild in
javascript, and therefore it won't show up in the querystring of the
page posted to:

ochild.parentNo de.removeChild( ochild);

But I was wondering if there was a way of doing it? A person can see
an inputbox for example disappear for a split second before the page
is posted... Is there a way of accessing the querystring itself in
javascript? Or some other way then removing the element?
Jul 23 '05 #1
7 7936
Utter Newbie wrote:
But I was wondering if there was a way of doing it? A person can see
an inputbox for example disappear for a split second before the page
is posted... Is there a way of accessing the querystring itself in
javascript?
No.
Or some other way then removing the element?


You could set it's disabled property to true, but obviously that is
useless when JS is disabled, or in user agents that don't support
that property, so you'd better simply ignore the value on the server
side.

ciao, dhgm
Jul 23 '05 #2

Dietmar Meier wrote:
Utter Newbie wrote:
But I was wondering if there was a way of doing it? A person can see an inputbox for example disappear for a split second before the page is posted... Is there a way of accessing the querystring itself in
javascript?


No.
Or some other way then removing the element?


You could set it's disabled property to true, but obviously that is
useless when JS is disabled, or in user agents that don't support
that property, so you'd better simply ignore the value on the server
side.

ciao, dhgm


why would you wanna do this? just don't process the unwanted value at
the other end.

micha

Jul 23 '05 #3
micha wrote:
so you'd better simply ignore the value on the server side.
why would you wanna do this? just don't process the unwanted value at
the other end.


That's exactly what I meant with "ignore".

ciao, dhgm
Jul 23 '05 #4
yes, right, didn't read closely enough.

micha

Jul 23 '05 #5
micha wrote:
Dietmar Meier wrote:
Utter Newbie wrote:

But I was wondering if there was a way of doing it? A person can
see
an inputbox for example disappear for a split second before the
page
is posted... Is there a way of accessing the querystring itself in
javascript ?


No.

Or some other way then removing the element?


You could set it's disabled property to true, but obviously that is
useless when JS is disabled, or in user agents that don't support
that property, so you'd better simply ignore the value on the server
side.

ciao, dhgm

why would you wanna do this? just don't process the unwanted value at
the other end.


At a guess, to mess with page content using javascript: in the
browser address field? If you run javascript from the address field,
you can disable form elements that you don't want sent to the server,
or put values in them other than those that the programmer has tried
to limit you to by using selects, radio buttons or checkboxes.

One use I've seen is when faced with radio buttons requesting whether
your sex is male or female, change the value to "gay" or "neuter" or
some such.

A well validated page will pick up the fact that a field is missing,
or that a value is not within the allowable selections, but a shoddy
site may not.
--
Fred
Jul 23 '05 #6
This wasn't my script I was modifying. For some reason they don't want
one field to show up in the querystring when it is sent to the page...
Even if it is empty...
http://www.postedpage.com/index.asp?...econdvalue=432

They wouldn't want myfirstvalue showing up at all in the first clicked
link even if there is no value...

Basically they used each anchor tag within a form to call a javascript
function through its onclick event. Some of these anchor tags would
read a value from an input box in the form and also append values
through the javascript using createElement. Then post the form with
the added elements through javascript. So the input box would get
posted along with all the created elements because it was part of the
orinal form. They were using something like this for that one link in
particuar....

the function()
{

var input;
if (document.creat eElement) {
input = document.create Element('input' );
input.type = 'hidden';
input.name = 'NewParameter';
input.value = 'TheParamValue' ;
oparent.appendC hild(input);

document.form1. elementIDontWan t.value = "";
}

document.form1. action="http://www.myurl.net/index.asp";

}
.... To submit the form along with its newly created elements in
javascript. All called through the onclick event... You can see they
blanked out the value but it doesn't get rid of the actual name of
the form element in the querystring.

But for one link they didn't want to post the input box param along
with the created element. Strange way of doing it seems but that is
what they did. That is why I removed the input box using removeChild
in the javascript for that one link click...

I just thought there had to be a better way of doing it... Personally
this is not how I would have gone about it. But I'm not a javascript
expert.
Jul 23 '05 #7
Actually this worked. Thanks!

On Wed, 27 Apr 2005 12:37:21 +0200, "Dietmar Meier"
<us************ ***@innoline-systemtechnik.d e> wrote:
Utter Newbie wrote:
But I was wondering if there was a way of doing it? A person can see
an inputbox for example disappear for a split second before the page
is posted... Is there a way of accessing the querystring itself in
javascript?


No.
Or some other way then removing the element?


You could set it's disabled property to true, but obviously that is
useless when JS is disabled, or in user agents that don't support
that property, so you'd better simply ignore the value on the server
side.

ciao, dhgm


Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1510
by: Ben R. | last post by:
I've got an asp.net application with a page that collects user info via forms and I'd like to have those values then passed to a 2nd page for a continuation which makes use of the entered values from the previous page. One way that I could think of would be to have the submit button's event handler call response.redirect with a querystring attached on based on values that I could attach on. First question: Could I do the same thing but...
3
1992
by: Phil Powell | last post by:
'GET THE HTML CONTENT FOR DISPLAY BAND ORIGIN Dim bandOriginDropdown On Error Resume Next set scraper = Server.CreateObject("Microsoft.XMLHTTP") if err then bandOriginDropdown = "" else scraper.open "GET", path & "/includes/soa_form_element_plugin.inc.asp", false scraper.send "tableID=2&fieldID=1&typeID=0"
5
1807
by: Arpan | last post by:
An ASP application retrieves records from a SQL Server database. In the first page of the application, the user has to enter a password & the columns retrieved from the DB table depends upon the password. For e.g. if the password entered is say, pwd1, then that user should be displayed the records of Column1 & Column2 only. If the password entered is say, pwd2, then that user should be displayed the records of Column1 & Column3 only. If...
3
4423
by: MikeR | last post by:
Hello - I pass an item to an asp page as a query string. The value has a space in it. On the receiving page, the value displays fine just as a variable, but if I use it to pre-fill an input box, only the first word displays. Ex: The URL- http://myserver.com/test.asp?Item=Blue%20Vase The page <http> <body>
5
2142
by: Miguel Dias Moura | last post by:
Hello, i have an ASP.net / VB page with a Script (submitValues) and a Form. 1. The form has 20 input texts and a "Submit" button. 2. The script declares 20 variables. The value of each variable is taken from each of the 20 input texts. 3. When the button "Submit" is click the variable values are sent to an email address using AspNetEmail.
3
1633
by: Cyrus Donders | last post by:
Hi, We are developing a web application in asp.net and all of a sudden there is this new requirement and I am having problems to implement it. My problem is that when a regular html page posts values to a aspx page in our website, I lose the values that were posted. If the values are send with a GET request I can access them in the Request collection. Does anyone have an idea why this happens and what I can do to solve this.
0
1090
by: Rico Singleton | last post by:
I currently have an asp page that contains a simple form and a few hidden fields. One of those hidden fields retrieves a value passed in when a link is clicked that passes a value (i.e http://www.somewhere.com/contact.asp?52 ) The code works fine on as an asp page on IIS 5.5 however, in trying to migrate the pages on to IIS 6.0 with .NET Framework enabled, I get a Runtime error everytime this value " " is used. The current code that...
2
3190
by: KFactor | last post by:
Is it possible to pass form variables to a page on another server using response.redirect? Or is there a secure way of passing sensitive information from one site to another such as a userID? I would like to avoid using the querystring. This is what I would like to do: When a user clicks on the link, I need to add them to the database and then
0
4100
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me with my problems. Now for my new little problem,I had a problem posting the values from checkbox fields to a database and thats the obstacle I overcame. Now the second part is my new problem is that I want that the next time that page loads for...
0
8823
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9530
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6793
isladogs
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...
0
4593
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...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3300
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
2
2775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.