DataCobalt Posted January 29, 2015 Report Share Posted January 29, 2015 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 Quote Link to comment Share on other sites More sharing options...
Jan Posted February 3, 2015 Report Share Posted February 3, 2015 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? Quote Link to comment Share on other sites More sharing options...
DataCobalt Posted February 3, 2015 Author Report Share Posted February 3, 2015 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. Quote Link to comment Share on other sites More sharing options...
Jan Posted February 3, 2015 Report Share Posted February 3, 2015 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! DataCobalt 1 Quote Link to comment Share on other sites More sharing options...
DataCobalt Posted February 3, 2015 Author Report Share Posted February 3, 2015 That works like a charm Jan! Thank you very much. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.