select form elsments

Discussion in 'JavaScript' started by Kain, Sep 28, 2009.

  1. #1
    I need to be able to make sure that when the back button on a page is clicked that the first option on a form drop down list is selected even if they selected another list item before hitting the back button

    any ideas
     
    Kain, Sep 28, 2009 IP
  2. pixmania

    pixmania Peon

    Messages:
    229
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    In the <form you can write autocomplete="off"> that way the browser wont remember what was written or selected last.

    Is that what you mean ?
     
    pixmania, Sep 28, 2009 IP
  3. ohteddy

    ohteddy Member

    Messages:
    128
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #3
    That's a bit tricky given the browser usually doesn't reload a page when the back button is selected.
    Or are you not talking about the browser back button, but a link that says go back?

    If the latter is the case then just use option selected=selected on the item you want to be the default.
     
    Last edited: Sep 28, 2009
    ohteddy, Sep 28, 2009 IP
  4. prasanthmj

    prasanthmj Member

    Messages:
    62
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    45
    #4
    Mention 'no cache' to make the browser refresh the page when the back button is pressed.
    If you can mention it in the HTTP header, it is better.
    Else you can use the HTML Meta tags(within the <head> tag) example is given below
    
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    <META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT">
    
    HTML:
     
    prasanthmj, Sep 28, 2009 IP
  5. Kain

    Kain Peon

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks folks, I didnt had any luck but i found a way out of it with php

    Thanks again
     
    Kain, Sep 29, 2009 IP
  6. pixmania

    pixmania Peon

    Messages:
    229
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    ..and its a secret, fine don't share your information, just keep asking questions.
     
    pixmania, Sep 29, 2009 IP