Jump to content
Sign in to follow this  
DataCobalt

Resetting Virtual Fields With Button?

Recommended Posts

Good afternoon,

 

I have made a few search pages with the method outlined here. These are working fantastic, but I would like a button to allow users to clear out the form and the method here has no effect whatsoever.

 

 

I have not deployed the version with the reset button so please let me know if this is just a feature that does not work in previews.

 

 

Thank you for your time,

 

-Blue

Share this post


Link to post
Share on other sites

Hi DataCobalt,

 

Do you want to clear the data that has entered to fields and parameters?

So, when a user clicks "Reset" he should see empty fields of the Search Page and all records of Results page?

Share this post


Link to post
Share on other sites

Exactly. I am having these virtual search fields take and send parameters so a user can continually tweak and try the same search criteria to find what they want, but at the moment that causes issues if the user wanted to start clean.

Share this post


Link to post
Share on other sites

Hello DataCobalt,

 

I am not sure that I have found the best solution, but it seems, it works.

 

You can use two Java Scripts.

Add the following code to the Header of your DataPage:

<SCRIPT LANGUAGE="JavaScript">
var site_URL = "URL_OF_YOUR_PAGE";
var is_it_reset = window.location.search;
if (is_it_reset.indexOf("cbResetParam") > -1)
{ window.location = site_URL; }
</SCRIPT>

Please insert the correct URL of your site in format http://mysite.com

And add the following code to the HTML block where the Reset button will be displayed:

<input type="reset" value="Reset" id="reset_button">

<SCRIPT LANGUAGE="JavaScript">
function reset_data()
{
var site_URL = "URL_OF_YOUR_PAGE" + "?cbResetParam=1";
window.location = site_URL;
}
document.getElementById("reset_button").onclick=reset_data;
</SCRIPT>

Please insert the correct URL and make sure, that the correct sign is used in the "?cbResetParam=1"

If parameters are used in your URL, it means, the "?" sign already present in the URL, then "&cbResetParam=1"

If no parameters and no "&" signs is used, then "?cbResetParam=1"

 

I hope, it helps!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...