# Field Value on Form Submit

**URL:** <https://community.hubspot.com/t/field-value-on-form-submit/41036>\
**Category:** CMS Development\
**Created:** [July 20, 2021, 8:11pm UTC](https://community.hubspot.com/t/field-value-on-form-submit/41036 "2021-07-20T20:11:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdeveloper](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sdeveloper/32/25270_2.png) [@sdeveloper](https://community.hubspot.com/u/sdeveloper)\
**Post date:** [July 20, 2021, 8:11pm UTC](https://community.hubspot.com/t/field-value-on-form-submit/41036/1 "2021-07-20T20:11:06Z")

</div>

Hi everyone,

I’m trying to create a custom form module that takes the input and calls an API with the information given in the form on submit. I’ve embedded the code from the form builder, but I’m not sure how to retrieve that values of the inputs.

A previous post suggested something along the lines of

```auto
hbspt.forms.create({
		portalId: "my_portal_id",
		formId: "my_form_id",
		onFormSubmit: function($form){
			if($('input[value="my_field_name"]').val() === 'No'){

```

I’m not sure how they got value=“my\_field\_name”, because I don’t know what the name of each form field is.

Essentially I want to store every input in each form field into a javascript variable.

Any help would be appreciated, I’m not sure if this is a trivial question or not..

---

<div class="post-metadata">

**Author:** ![sdeveloper](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sdeveloper/32/25270_2.png) [@sdeveloper](https://community.hubspot.com/u/sdeveloper)\
**Post date:** [July 20, 2021, 9:54pm UTC](https://community.hubspot.com/t/field-value-on-form-submit/41036/2 "2021-07-20T21:54:26Z")

</div>

`$('input[value="{{formFieldValue}}"]')`

I’ve read that this is the format to follow, but how do I know what to put in formFieldValue?

---

<div class="post-metadata">

**Author:** ![JBeatty](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jbeatty/32/52252_2.png) [@JBeatty](https://community.hubspot.com/u/JBeatty)\
**Post date:** [July 21, 2021, 2:56pm UTC](https://community.hubspot.com/t/field-value-on-form-submit/41036/3 "2021-07-21T14:56:55Z")

</div>

Hi @sdeveloper,

The format you are showing is selecting a DOM input element with that specific value.

When you do:

`$('input[value="{{formFieldValue}}"]')`

This would select a form field where the user had literally entered “{{formFieldValue}}”. If you are instead trying to grab a specific form field regardless of what the value is, to test the value against other possibilities, then you would do something like this:

`$form.find('input[name="{{Internal-Property-ID}}"]').val()`

Where {{Internal-Property-ID}} is replaced with the internal id of the property on the form. Which you can find in the form builder by looking for the italicized text:

 ![Screenshot 2021-07-21 085303.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/4/41e4761f155435a1643081e801e9aa0a71fe2725.png)

So if I wanted to grab the value of that field, from within the onFormSubmit function, I would use:

`$form.find('input[name="dummy_text_field"]').val()`

Also note the use of $form rather than $, as to only search the specific form rather than the entire page.
