Finding the values of Select List

  • 1 June 2023
  • 1 reply



I am trying to find out how many time each option is submitted in a select list.  I think I need to use Snapshots but it does not seem to be working?


<select id=”x”>

   <option value =”1”>1</option>
    <option value =”2”>2</option>   
    <option value =”3”>3</option>


<input type="submit" id=”y” />





Best answer by Jonas-Heap 2 June 2023, 16:29

View original

1 reply

Userlevel 3
Badge +2

Hi Tootsie, thanks for posting! I think I see the problem here. Heap detects the submission event happening on the form element, rather than the input element, so you would want to change “Submit on #y” to “Submit on #parentFormElement”, where #parentFormElement is a <form> element that is the parent of both the <select> element and the <input> element. Once you do that, the snapshot will correctly trigger on form submission and Heap will capture the value of #x!