Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

restore the data in combo box on using back button

by gowthamtr (Sexton)
on Dec 12, 2006 at 09:40 UTC ( [id://589245]=perlquestion: print w/replies, xml ) Need Help??

gowthamtr has asked for the wisdom of the Perl Monks concerning the following question:

I am using 3 combo boxes, the values of 2nd and 3rd combos are set by events triggered using java script.
Initially, the data in combo box 2 and 3 is null...The data in combo box 2 is set when an event is triggered by changing the value in combo box 1. and similar is the case for combo box 3.
After Submitting, when we use the back button the values in the second and third boxes are lost except for the first combo box.
Can u suggest the solution???
  • Comment on restore the data in combo box on using back button

Replies are listed 'Best First'.
Re: restore the data in combo box on using back button
by themage (Friar) on Dec 12, 2006 at 10:09 UTC
    Hi gowthamtr,

    That will depende on how the specific browser you're using implements the back funcionality.

    Anyway, if you use javascript to create or change options in forms, you should not use the back button, but a button implemented by you, that will reinitiate the selects to the last selected values.

    You can't relay on any default browser behaviour as diferent browsers and even diferent versions of the same browser, or even diferent plugins on the same version of the same browser will work in diferent ways.

    TheMage
    Talking Web
      How will u create a button that will reinitiate the selects to the last selected values?

      The values in combo 2 will be loaded only when some event occurs.
        You could just forget about having a back button displayed to go back, and just have the CGI script take you back to the submission page. The CGI script would pass the initial box 2 and box 3 values as parameters to the submission page. You could then use JavaScript to re-set the initial box 2 and box 3 values ...

        There is no reason why you cannot pass around a few cookies either.

        Hi gowthamtr,

        That is an information I can give you without some more information on what you are doing.

        But I presume you could send to the previous page some information on the selected values, and then pre-load the selects and pre-select the correct values when generating the page.

        That's what I've done in the past, in similar events.

        An alternative is to have a javascript that calls the same methods that were called as eventHandlers.

        TheMage
        Talking Web

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://589245]
Approved by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-26 04:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found