473,383 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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.parentNode.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 7912
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.createElement) {
input = document.createElement('input');
input.type = 'hidden';
input.name = 'NewParameter';
input.value = 'TheParamValue';
oparent.appendChild(input);

document.form1.elementIDontWant.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.de> 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
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...
3
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...
5
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...
3
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,...
5
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...
3
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...
0
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...
2
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? ...
0
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.