# Refresh form without refreshing the page

**URL:** <https://community.hubspot.com/t/refresh-form-without-refreshing-the-page/19211>\
**Category:** CMS Development\
**Tags:** javascript, forms\
**Created:** [March 4, 2020, 3:15pm UTC](https://community.hubspot.com/t/refresh-form-without-refreshing-the-page/19211 "2020-03-04T15:15:25Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![YChuskit](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ychuskit/32/13521_2.png) [@YChuskit](https://community.hubspot.com/u/YChuskit)\
**Post date:** [December 16, 2021, 2:36pm UTC](https://community.hubspot.com/t/refresh-form-without-refreshing-the-page/19211/3 "2021-12-16T14:36:33Z")

</div>

hey @valerajoey,

hbspt.forms.create({  
portalId: ‘2333626’,  
formId: ‘9a3ba836-f31f-4869-8d28-d264cc4259a8’,  
onFormSubmit: function($form) {  
$form[0].reset();  
}  
});

is this rigth code ? what should be the js here

onFormSubmit: function($form) {  
what should i write here ?  
}

i tried above code but i am getting error

---

_[View the full topic](https://community.hubspot.com/t/refresh-form-without-refreshing-the-page/19211)._
