search depending on what user selects

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

    #1

    search depending on what user selects

    what i want to do is create several radio buttons and a textbox for
    searching purposes. the search will perform a search depending on
    which button the user selects.

    here is what i have now:

    - for each radio button, i use the onClick event handler, which calls
    a function called showMe()

    - showMe() {
    if (button 1 was selected)
    document.write( 'form which will search down path A');
    else if (button 2 was selected)
    document.write( 'form which will search down path B');
    else if (button 3 was selected)...
    }

    this works, but once the user makes their selection, the search form
    will pop up on another page. how do i fix it so that the search form
    will display on the same page as the radio buttons? Is there any
    other way to accomplish this?
  • Erwin Moller

    #2
    Re: search depending on what user selects

    bdawg wrote:
    [color=blue]
    > what i want to do is create several radio buttons and a textbox for
    > searching purposes. the search will perform a search depending on
    > which button the user selects.
    >
    > here is what i have now:
    >
    > - for each radio button, i use the onClick event handler, which calls
    > a function called showMe()
    >
    > - showMe() {
    > if (button 1 was selected)
    > document.write( 'form which will search down path A');
    > else if (button 2 was selected)
    > document.write( 'form which will search down path B');
    > else if (button 3 was selected)...
    > }
    >
    > this works, but once the user makes their selection, the search form
    > will pop up on another page. how do i fix it so that the search form
    > will display on the same page as the radio buttons? Is there any
    > other way to accomplish this?[/color]

    Hi,

    What excactly do you expect javascript to do? Overwrite your old form? It
    will not.
    You CAN make a form on a existing page from scratch and change that form,
    but that takes a lot more effort than just document.write, and is most of
    the time completely unneeded and overcomplex. Of course, that depends on
    your requirements.

    I would advise you to take another route.
    here are 2 suggestions:
    1) Maybe it is a lot easier to make a frame which contains the form, and
    switch the content in that frame depending on the radiobuttonacti ons.

    2) If your only diffence between between the forms is some searchpath (I
    don't know what that means), maybe it is a lot easier to set some hidden
    variables in the form that tell the receiving script what to search.

    Hope that helps.

    Good luck.
    Regards,
    Erwin Moller

    Comment

    Working...