Javascript to modify query string of request

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Glenn

    #1

    Javascript to modify query string of request

    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?

  • chotiwallah@web.de

    #2
    Re: Javascript to modify query string of request


    Glenn wrote:[color=blue]
    > Searching through google groups, I have not found anyone able to[/color]
    modify[color=blue]
    > 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[/color]
    hoped.[color=blue]
    > 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?[/color]

    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_stri ng;

    if your query string has the format of

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

    micha

    Comment

    Working...