Kevin
Kevin

Reputation: 229

Refresh page with html button, except

How can I implement a "website-refresh-button" which does NOT refresh text input-panels?

Refresh-Button:

<input name="Button" class="button" type="button" size="20" maxlength="20" value="Load..." onClick="history.go(0)">

Text input-panels:

<input name="StartDate" class="inputPanel" type="text" size="20" maxlength="20" value="2013-08-20">
<input name="StartTime" class="inputPanel" type="text" size="20" maxlength="20" value="22:56:25">
<input name="EndDate" class="inputPanel" type="text" size="20" maxlength="20" value="2013-08-22">
<input name="EndTime" class="inputPanel" type="text" size="20" maxlength="20" value="22:56:26">

Thanks!

Upvotes: 0

Views: 230

Answers (2)

Ky -
Ky -

Reputation: 32103

Since you already gave a name to all the inputs, I would simply change the button input's type to a submit, and put it all inside a form with method="post" action="#". Then, once it's submitted, you take all the items in the POST (server-side) and put them into the inputs before giving the user the end HTML. If you have no access to the backend server, then ne1410s's solution is your best fit.

Upvotes: 0

ne1410s
ne1410s

Reputation: 7082

In order to preserve the values on a proper refresh, you will have to persist them somehow. This can be done in browsers with local storage or cookies or similar.

See this SO post for more info: How to reload current page without losing any form data?

Upvotes: 1

Related Questions