RESET BUTTON SEARCH

Hello everyone,
I want my visitors when they have finished their search to be able to start a new search from the beginning of the original code process.
I have a user input where user input a year then a clickbutton that trigger a query and shows the result in a table. From that result, user select an option and click again on another clickbutton that start another query that shows results on different tables : from that point, if they wish to get results for another year it needs to go back to the 1st step of the process as these infos are in fact a selector and without them results are going to be wrong.
I was thinking to add a button with ’ start a new search’ text that clicked will restart the whole process. IS that possible? And how can it be done?

Thanks and best regards,

Thierry

Hi,

Can you be more specific in describing the flow.
I don’t understand if both buttons and user inputs are in the same page or each table is presenting in different page?
and should different year present different result ? why not to go beck to step 1?

Best,
Sapir

1 Like

Hello Sapir,

and thanks for answering me.
Exactly what I would like to do: go back to step 1 but how can we do that? I have no idea and in doing so, will the user input will go back to its original step ( placeholder text ) and the process start over?

The flow is on 1 page only but it is a little complicated.

  • User input 1 and button ‘start1’ are present on loading. When button ‘start1’ is clicked, input 1 and button ‘start1’ collapse.
  • From there, input 2, button ‘start2,’, radiogroup1 and table1 expand. Table 1 just shows the 2 options available and radiogroup1 validate the choice. input2 shows the data from input1 ( artwork obligation ) .
  • When clicked and after option choice, ‘button ‘start2’’ expand table2, table3, table 4 + image1 ( product picture ) + image2 ( explanation text ) + 2 other minor texts ( always the same ).

If I input a new year on the user input1 and click on button ‘start2’, it will find the new values correctly except for Table1 that rely on input1 ( collapsed by now ) so the date limitation for the 2 options can be wrong ( aka : from July 05 until July 04 that in fact for the specific year selected should read : from June 02 Until June 01 ). I will precise that the result is correct as the 2 options clicked on ‘radiogroup1’ are correct. It is just the value of the text shown in table1 that is not. The proces work except for this particular table that not update and the lack of elegance.

And yes each year has different result. So what would be great is to be able to go back to step 1 when a visitor click on a 'new search ’ button that would restart the whole process. As I said I do not know how I can code that. I have been to your forum to search, and other places but to no avail. Any idea?

Thanks again Sapir,

Thierry

Hi,

Please send me a URL to your site and specify the name of the page.

Thanks,
Sapir

Just use $w(’ #dataset1 ').setFilter() to clear it.

You can have a CLEAR button that resets the fields in the onClick() function.
To clear all of your filter selections, add the following onClick() function to your CLEAR button:

export function button1_click(event, $w) {
	//Add your code for this event here: 
	$w("#selection1").selectedIndex = 0;
	// add code for other selection menus
}

The above routine just needs to set all of the selection menus to the default value.

Or you can clear the year input box when the page is ready:

$w.onReady( function() {
  $w("#yearinput").value="";
   } );

Hello Sapir,

thanks for your answer but I have found a way to go back to the original state : in fact I use the step 2 of the ‘givemeawhisky’ ( I prefer bourbon ) in his reply. It works so perfect.
Have a very lovely day,

Thierry

Hello,

and thank you for taking time to answer my question. In fact I had by chance come with your second option and it worked so let say : problem solved.
Thanks for your time,
Have a nice day and a drink for sure,

Thierry