Erik
Erik

Reputation: 5791

Using javascript:history.go(-1) works but I lose css properties and scripts

When my clients submit a form and get an error they're taken to a page with a link to go back. I'm using javascript:history.go(-1) to go back to the form.

I'm loosing my css functionality with background changes and colors, etc. of the form when the client goes back.

I don't want the client to have to re-type everything agian with a refresh.

Is there a way to avoid this?

Upvotes: 0

Views: 393

Answers (2)

Christian Romeni
Christian Romeni

Reputation: 192

Why don't you save all the Data entered in the PHP Session, and (instead of history.go(-1)) Place a link to the Form again, where you check if there are values in the session, and write them in the Form-Field with PHP?

Something like

$_SESSION['name']=$_POST['name']

and backwards..

You could even do that without showing an error Page, and displaying the error on the form itself...

Upvotes: 1

rjz
rjz

Reputation: 16510

If the CSS you mention is being entered as part of the form, you might check out using a shim like Sisyphus.js to ensure cross-browser persistence when your user steps back through the form.

Upvotes: 0

Related Questions