By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,069 Members | 1,716 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,069 IT Pros & Developers. It's quick & easy.

Javascript to modify query string of request

P: n/a
Searching through google groups, I have not found anyone able to modify
the query string of a request. I was hoping to make the query string
as short as possible so that a search with many criteria could be
bookmarked. I had planned to have the query string be
key=value for each criteria
But with dropdowns, the default choice is always submitted. There
were other parameters that I had to use that were longer than I hoped.
And checkboxes are actually value=on. Is there anyway to modify the
query string before the form is submitted?

One possibility that I thought of was to have a hidden field in one
form and have javascript to populate the hidden field from the form
that shows. You could submit the form with the hidden field.
Is there any easier way?

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

Glenn wrote:
Searching through google groups, I have not found anyone able to modify the query string of a request. I was hoping to make the query string
as short as possible so that a search with many criteria could be
bookmarked. I had planned to have the query string be
key=value for each criteria
But with dropdowns, the default choice is always submitted. There
were other parameters that I had to use that were longer than I hoped. And checkboxes are actually value=on. Is there anyway to modify the
query string before the form is submitted?

One possibility that I thought of was to have a hidden field in one
form and have javascript to populate the hidden field from the form
that shows. You could submit the form with the hidden field.
Is there any easier way?


that comes to my mind (though i never tried it)

1. prevent the submission of the form with some eventhandler
2. have javascript read the values of the form fields
3. build your custom query string
4. window.location.href = 'somefile.htm?' + your_query_string;

if your query string has the format of

?name=value&name2=value2...
it can be used like data from a form sent with method=get

micha

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.