# Before submit function help please

**URL:** <https://community.fliplet.com/t/before-submit-function-help-please/658>\
**Category:** Get Help\
**Created:** [July 10, 2024, 5:57pm UTC](https://community.fliplet.com/t/before-submit-function-help-please/658 "2024-07-10T17:57:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmoralesrodriguez](https://dub1.discourse-cdn.com/flex017/user_avatar/community.fliplet.com/cmoralesrodriguez/32/339_2.png) [@cmoralesrodriguez](https://community.fliplet.com/u/cmoralesrodriguez)\
**Post date:** [July 10, 2024, 5:57pm UTC](https://community.fliplet.com/t/before-submit-function-help-please/658/1 "2024-07-10T17:57:17Z")

</div>

Hi,  
I have this code below in my app. It should be getting the users associate year and then inserting their seniority based on the number, for some reason it is marking everyone as a junior. Is there something wrong with this code? Is there a better way to do this?

Help please, thanks!

Fliplet.Hooks.on(‘beforeFormSubmit’, function(data) {

let associateYear = data[‘Associate Year’];  
console.log('associate year ’ + associateYear);  
var associateSeniority;

if (associateYear \>= 4) {  
associateSeniority = ‘Senior’;  
} else {  
associateSeniority = ‘Junior’;  
}  
data[‘Associate Seniority’] = associateSeniority;

---

<div class="post-metadata">

**Author:** ![YuliiaKovalenko](https://avatars.discourse-cdn.com/v4/letter/y/d2c977/32.png) [@YuliiaKovalenko](https://community.fliplet.com/u/YuliiaKovalenko)\
**Post date:** [July 11, 2024, 9:05am UTC](https://community.fliplet.com/t/before-submit-function-help-please/658/2 "2024-07-11T09:05:26Z")

</div>

Hi, Catalina!  
This code seems correct. Could you please let me know what is printed to the console as the result of this line of code `console.log('associate year ’ + associateYear);` when the form is submitted?
