# Auto Reloading Form

**URL:** <https://forums.knack.com/t/auto-reloading-form/14554>\
**Category:** API & Custom Code\
**Created:** [July 2, 2023, 4:08pm UTC](https://forums.knack.com/t/auto-reloading-form/14554 "2023-07-02T16:08:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph2](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@Joseph2](https://forums.knack.com/u/Joseph2)\
**Post date:** [July 2, 2023, 4:08pm UTC](https://forums.knack.com/t/auto-reloading-form/14554/1 "2023-07-02T16:08:20Z")

</div>

The code below is used to set focus on a dropdown selection list when the view renders. It works when the page is orginally loaded, however when the form is submitted and ‘automatically reloaded’ it does not work. Any ideas on how to get it to work when the form is ‘automatically reloaded’ would be appreciated.

$(document).ready(function() {  
$(document).on(‘knack-scene-render.scene\_32’, function(event, scene) {  
setTimeout(function() {  
var $dropdownToggle = $(‘#view\_104\_field\_154\_chzn \> a’);  
var $searchInput = $(‘#view\_104\_field\_154\_chzn input[type=“text”]’);

```
     // Add the class to show the dropdown options
     $dropdownToggle.addClass('chzn-with-drop');

     // Trigger the mousedown event to open the dropdown
     $dropdownToggle.trigger('mousedown');

     // Set focus on the search input field
     $searchInput.focus();
  }, 100); // Adjust the delay (in milliseconds) as needed

```

});  
});

---

<div class="post-metadata">

**Author:** ![BradStevens](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/bradstevens/32/140_2.png) [@BradStevens](https://forums.knack.com/u/BradStevens)\
**Post date:** [July 8, 2023, 3:32am UTC](https://forums.knack.com/t/auto-reloading-form/14554/2 "2023-07-08T03:32:50Z")

</div>

Hey @Joseph2 would it work inside the view render event instead of the scene render?

i.e.

```auto
$(document).on('knack-view-render.view_104', function(event, view, data) {
    setTimeout(function() { .....

    });
});

```
