Jump to content

Recommended Posts

Hi

 

Not sure if this is the right place for this.

 

I have an application that has various form fields with drop down list. Users select items from the various lists and press add, which puts some form fields at the bottom of the screen using Javascript, with the actual input fields held in hidden fields inside a new div, along with a bit of visable text. Once they have finished adding fields then the form is submitted, generating a graph.

 

Now the browser I mainly use is Opera and one advantage of this is that the back button doesn't reload the form normally. It used to be the case that pressing back mean all the dynamically added form fields were still there, but on the latest versions they are not.

 

I really don't want to modifiy it to try and pass back all the selected options and recreate the screen.

 

Any ideas on getting Opera to keep the contents of the dynamically created divs when the back button is pressed (note that the normal form fields keep their value).

 

All the best

 

Keith

 

PS - if you are wondering the site enables you to generate a graph of thrust at the rear wheel against speed, in various gears on motorcycles, and allow you to overlay graphs with the same bike but with different gearing - hence being able to add the same bike several times with different gearing and the dynamically generated input fields.

Link to comment
https://forums.phpfreaks.com/topic/148111-persistence-of-dynamic-html/
Share on other sites

You could add an event handler to onload and write a function in Javascript that resets the form. I would be careful with that though. People might have entered something wrong and want to go back to correct it. It might be annoying for them if they have to start over. So perhaps it would be better to have a reset button that triggers the aforementioned resetting function.

Hi

 

Trouble is that the data that I would need to reset the form is in the hidden dynamically created fields that the browser has wiped out when returning to the page.

 

Although that did give me a thought. As the number of sets of data is limited (currently to 10, as otherwise the resulting graphs get too difficult to read) I could put the hidden fields up in advance and just populate them with Javascript. Just would rather not have to have predefined numbers of lines in the design of the page.

 

All the best

 

Keith

Oh sorry, I think I read your first message wrong. I read it as though the browser wasn't resetting, but you wanted it to.

 

I suppose you then just could redisplay the form below the graph to the user. In that way you eliminate the problem by not having to go back in the first place.

Hi

 

Trouble is the possibly rather large amount of data. I could use javascript / ajax to put the image at the bottom of the page I suppose (only issue is the length of the query string, but should be fine for that), and just reset it to get the new graph.

 

The page is:-

 

http://www.bikegraph.co.uk/TorqueGraphs.php

 

It works fine in older versions of Opera, but not in the current versions which leave the normal form fields set (which I like and is one of the reasons I have used Opera for years) but wipes out the dynamically created text and form fields.

 

I suppose the advantage of putting the graph on the bottom of the screen is that it wouldn't wipe out the fields in IE either.

 

All the best

 

Keith

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.